[Twisted-web] Authentication with twisted.web

Alex Levy twisted-web@twistedmatrix.com
Thu, 29 Jan 2004 10:48:31 -0500


--=-9Z7FoVzDlmxZoaFa+ck4
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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 hap=
py=20
> building the user authentication side of things, but I'm not sure how to =
get=20
> the site to require authentication. I'm looking for what I think is "Basi=
c"=20
> authentication - the one that causes the browser to pop up an "enter user=
name=20
> 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=3D"foo"')

Wherever else:
>>> u =3D request.getUser()
>>> p =3D request.getPassword()

Hope this helps.

--=20
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_


--=-9Z7FoVzDlmxZoaFa+ck4
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBAGStOVM70CYlRlK4RAs4eAJ9pV/nScXCxxjoHDLQPvTi/zHE7CQCgk72i
7ek3I5dxG8XDP3ebzbOG6Rg=
=viCa
-----END PGP SIGNATURE-----

--=-9Z7FoVzDlmxZoaFa+ck4--