I want to build a web application which requires users to log on. I'm happy building the user authentication side of things, but I'm not sure how to get the site to require authentication. I'm looking for what I think is "Basic" authentication - the one that causes the browser to pop up an "enter username and password" dialog box. I know that I could design my own front page form, to allow the user to enter a username directly, but that's not what I want here. Is this possible? (I'm sure it is, I just can't find what I should be looking for in the docs!) Thanks, Paul.
On Thu, 2004-01-29 at 09:36, Paul Moore wrote:
I want to build a web application which requires users to log on. I'm happy building the user authentication side of things, but I'm not sure how to get the site to require authentication. I'm looking for what I think is "Basic" authentication - the one that causes the browser to pop up an "enter username and password" dialog box.
A Google search for "site:twistedmatrix.com basic http authentication" turns up a number of useful links, but until Pyramid's back on its feet, you've got to go cache-hunting. Here's a few tidbits that'll probably help: In Resource.render():
request.setHeader('WWW-authenticate', 'basic realm="foo"')
Wherever else:
u = request.getUser() p = request.getPassword()
Hope this helps. -- Alex Levy WWW: http://mesozoic.geecs.org "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_
On Jan 29, 2004, at 10:48 AM, Alex Levy wrote:
On Thu, 2004-01-29 at 09:36, Paul Moore wrote:
I want to build a web application which requires users to log on. I'm happy building the user authentication side of things, but I'm not sure how to get the site to require authentication. I'm looking for what I think is "Basic" authentication - the one that causes the browser to pop up an "enter username and password" dialog box.
A Google search for "site:twistedmatrix.com basic http authentication" turns up a number of useful links, but until Pyramid's back on its feet, you've got to go cache-hunting.
Here's a few tidbits that'll probably help:
In Resource.render():
request.setHeader('WWW-authenticate', 'basic realm="foo"')
Wherever else:
u = request.getUser() p = request.getPassword()
Hope this helps.
Just to let you know, Glyph also added basic http authentication login support to nevow.guard the other day, for Quotient. I think all you have to do is, on your ANONYMOUS resource, set the response code to UNAUTHORIZED. When the user provides a username and password, those credentials are passed to your realm. Maybe glyph can shed more light, but I don't think he is on this list. I'll ask him about it. dp
Donovan Preston <dp@divmod.org> writes:
On Jan 29, 2004, at 10:48 AM, Alex Levy wrote:
A Google search for "site:twistedmatrix.com basic http authentication" turns up a number of useful links, but until Pyramid's back on its feet, you've got to go cache-hunting.
Cool. Thanks, Alex. I couldn't get the right terms to google with (authorisation rather than authentication :-() Must get more sleep...
Just to let you know, Glyph also added basic http authentication login support to nevow.guard the other day, for Quotient. I think all you have to do is, on your ANONYMOUS resource, set the response code to UNAUTHORIZED. When the user provides a username and password, those credentials are passed to your realm. Maybe glyph can shed more light, but I don't think he is on this list. I'll ask him about it.
That sounds good. I'll keep this for later perusal. (When I get my head round nevow). Paul -- This signature intentionally left blank
participants (3)
-
Alex Levy
-
Donovan Preston
-
Paul Moore