Just
flipping this one back to the group.
Has
anyone tried this technique and gotten it to work?
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Blake Foss - Web Foot Forward
Sent: Monday, 17 February 2003 12:02 AM
To: CFAussie Mailing List
Subject: [cfaussie] WWW-Authentication
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Blake Foss - Web Foot Forward
Sent: Monday, 17 February 2003 12:02 AM
To: CFAussie Mailing List
Subject: [cfaussie] WWW-Authentication
Hi
All,
Has anyone ever used
the WWW-Authenticate 401 method to password protect a site?
I want to add a
quick login within a staging site I am working on and instead of building a
login form as per the norm I want the browser to pop up the username and
password window like the windows basic authentication.
The code I am using
is below,
<cflogin>
<cfif isDefined( "cflogin" )>
<cfif cflogin.name EQ "myusername" and cflogin.password EQ "mypassword">
<cfset roles = "user">
</cfif>
</cfif>
<cfif isDefined( "roles" )>
<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#roles#">
<cfelse>
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<cfheader statuscode="401">
<cfheader name="WWW-Authenticate" value="Basic realm=""MySecurity""">
<cfoutput>Not authorised</cfoutput>
<cfabort>
</cfif>
</cflogin>
<cfif isDefined( "cflogin" )>
<cfif cflogin.name EQ "myusername" and cflogin.password EQ "mypassword">
<cfset roles = "user">
</cfif>
</cfif>
<cfif isDefined( "roles" )>
<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#roles#">
<cfelse>
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<cfheader statuscode="401">
<cfheader name="WWW-Authenticate" value="Basic realm=""MySecurity""">
<cfoutput>Not authorised</cfoutput>
<cfabort>
</cfif>
</cflogin>
When I activate it
on the server I get the pop up window asking for the username, password AND
domain. I enter the username and password, correctly as embedded in the page and
the thing just pops up the window again. I keep entering the username and
password and it keeps happening. Now the server has locked me out.
Oops!
Has anyone used this
type of authentication with CF? If I can get it to work I will tie it into the
database and do it properly. For some reason I just like the little pop up
window and thought it would save some time over coding a form page as it will be
removed when the site goes live. Looks like a blew that theory, I think I have
spent more time figuring out this problem than doing it the way I know and have
done before.
Thanks in
advance,
Blake
Foss
-----------------------------------------------------------------------------------
Blake Foss
Web Foot Forward
p: 61 2 9340 4401
f: 61 2 8080 8190
m: 0410 747 620
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/ ---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/
