AuthKit

 

digest

HTTP digest authentication middleware

This implementation is identical to the paste.auth.digest implemenation.

Note:: If users are prompted to sign in this also seems to have the effect of
signing them out.

Attributes

a ACCEPT

<_MultiValueHeader Accept (RFC 2616, 14.1)>

a ACCEPT_CHARSET

<_MultiValueHeader Accept-Charset (RFC 2616, 14.2)>

a ACCEPT_ENCODING

<_MultiValueHeader Accept-Encoding (RFC 2616, 14.3)>

a ACCEPT_LANGUAGE

<_AcceptLanguage Accept-Language (RFC 2616, 14.4)>

a ACCEPT_RANGES

<_AcceptRanges Accept-Ranges (RFC 2616, 14.5)>

a AGE

<_SingleValueHeader Age (RFC 2616, 14.6)>

a ALLOW

<_MultiValueHeader Allow (RFC 2616, 14.7)>

a AUTHORIZATION

<_Authorization Authorization (RFC 2617)>

a AUTH_TYPE

<EnvironVariable AUTH_TYPE>

a CACHE_CONTROL

<_CacheControl Cache-Control (RFC 2616, 14.9)>

a CONNECTION

<_MultiValueHeader Connection (RFC 2616, 14.10)>

a CONTENT_DISPOSITION

<_ContentDisposition Content-Disposition (RFC 2183)>

a CONTENT_ENCODING

<_MultiValueHeader Content-Encoding (RFC 2616, 14.11)>

a CONTENT_LANGUAGE

<_MultiValueHeader Content-Language (RFC 2616, 14.12)>

a CONTENT_LENGTH

<_ContentLength Content-Length (RFC 2616, 14.13)>

a CONTENT_LOCATION

<_SingleValueHeader Content-Location (RFC 2616, 14.14)>

a CONTENT_MD5

<_SingleValueHeader Content-MD5 (RFC 2616, 14.15)>

a CONTENT_RANGE

<_ContentRange Content-Range (RFC 2616, 14.6)>

a CONTENT_TYPE

<_ContentType Content-Type (RFC 2616, 14.17)>

a COOKIE

<_MultiValueHeader Cookie (RFC 2109/Netscape)>

a DATE

<_DateHeader Date (RFC 2616, 14.18)>

a ETAG

<_SingleValueHeader ETag (RFC 2616, 14.19)>

a EXPECT

<_MultiValueHeader Expect (RFC 2616, 14.20)>

a EXPIRES

<_DateHeader Expires (RFC 2616, 14.21)>

a FROM

<_SingleValueHeader From (RFC 2616, 14.22)>

a HOST

<_SingleValueHeader Host (RFC 2616, 14.23)>

a IF_MATCH

<_MultiValueHeader If-Match (RFC 2616, 14.24)>

a IF_MODIFIED_SINCE

<_IfModifiedSince If-Modified-Since (RFC 2616, 14.25)>

a IF_NONE_MATCH

<_MultiValueHeader If-None-Match (RFC 2616, 14.26)>

a IF_RANGE

<_SingleValueHeader If-Range (RFC 2616, 14.27)>

a IF_UNMODIFIED_SINCE

<_DateHeader If-Unmodified-Since (RFC 2616, 14.28)>

a LAST_MODIFIED

<_DateHeader Last-Modified (RFC 2616, 14.29)>

a LOCATION

<_SingleValueHeader Location (RFC 2616, 14.30)>

a MAX_FORWARDS

<_SingleValueHeader Max-Forwards (RFC 2616, 14.31)>

a PATH_INFO

<EnvironVariable PATH_INFO>

a PRAGMA

<_MultiValueHeader Pragma (RFC 2616, 14.32)>

a PROXY_AUTHENTICATE

<_MultiValueHeader Proxy-Authenticate (RFC 2616, 14.33)>

a PROXY_AUTHORIZATION

<_SingleValueHeader Proxy-Authorization (RFC 2616, 14.34)>

a RANGE

<_Range Range (RFC 2616, 14.35)>

a REFERER

<_SingleValueHeader Referer (RFC 2616, 14.36)>

a REMOTE_SESSION

<EnvironVariable REMOTE_SESSION>

a REMOTE_USER

<EnvironVariable REMOTE_USER>

a REQUEST_METHOD

<EnvironVariable REQUEST_METHOD>

a RETRY_AFTER

<_SingleValueHeader Retry-After (RFC 2616, 14.37)>

a SCRIPT_NAME

<EnvironVariable SCRIPT_NAME>

a SERVER

<_SingleValueHeader Server (RFC 2616, 14.38)>

a SET_COOKIE

<_MultiEntryHeader Set-Cookie (RFC 2109/Netscape)>

a TE

<_MultiValueHeader TE (RFC 2616, 14.39)>

a TRAILER

<_MultiValueHeader Trailer (RFC 2616, 14.40)>

a TRANSFER_ENCODING

<_MultiValueHeader Transfer-Encoding (RFC 2616, 14.41)>

a UPGRADE

<_MultiValueHeader Upgrade (RFC 2616, 14.42)>

a USER_AGENT

<_SingleValueHeader User-Agent (RFC 2616, 14.43)>

a VARY

<_MultiValueHeader Vary (RFC 2616, 14.44)>

a VIA

<_MultiValueHeader Via (RFC 2616, 14.45)>

a WARNING

<_MultiEntryHeader Warning (RFC 2616, 14.46)>

a WWW_AUTHENTICATE

<_MultiEntryHeader WWW-Authenticate (RFC 2616, 14.47)>

a log

<logging.Logger instance at 0xb72e9a2c>

Functions

f digest_password(realm, username, password) ...

construct the appropriate hashcode needed for HTTP digest

f load_digest_config(app, auth_conf, app_conf=None, global_conf=None, prefix='authkit.digest') ...

f make_digest_auth_handler(app, auth_conf, app_conf=None, global_conf=None, prefix='authkit.digest') ...

f make_digest_handler(app, auth_conf, app_conf=None, global_conf=None, prefix='authkit.digest') ...

Classes

C AuthDigestAuthenticator(...) ...

implementation of RFC 2617 - HTTP Digest Authentication

This class contains 5 members.

C AuthDigestHandler(...) ...

middleware for HTTP Digest authentication (RFC 2617)

This component follows the procedure below:

  1. If the REMOTE_USER environment variable is already populated; then this middleware is a no-op, and the request is passed along to the application.
  2. If the HTTP_AUTHORIZATION header was not provided or specifies an algorithem other than digest, then a HTTPUnauthorized response is generated with the challenge.
  3. If the response is malformed or or if the user's credientials do not pass muster, another HTTPUnauthorized is raised.
  4. If all goes well, and the user's credintials pass; then REMOTE_USER environment variable is filled in and the AUTH_TYPE is listed as 'digest'.

Parameters:

application

The application object is called only upon successful authentication, and can assume environ['REMOTE_USER'] is set. If the REMOTE_USER is already set, this middleware is simply pass-through.

realm

This is a identifier for the authority that is requesting authorization. It is shown to the user and should be unique within the domain it is being used.

authfunc

This is a callback function which performs the actual authentication; the signature of this callback is:

authfunc(realm, username) -> hashcode

This module provides a 'digest_password' helper function which can help construct the hashcode; it is recommended that the hashcode is stored in a database, not the user's actual password (since you only need the hashcode).

This class contains 2 members.

C DigestAuthHandler(...) ...

middleware for HTTP Digest authentication (RFC 2617)

This component follows the procedure below:

  1. If the REMOTE_USER environment variable is already populated; then this middleware is a no-op, and the request is passed along to the application.
  2. If the HTTP_AUTHORIZATION header was not provided or specifies an algorithem other than digest, then a HTTPUnauthorized response is generated with the challenge.
  3. If the response is malformed or or if the user's credientials do not pass muster, another HTTPUnauthorized is raised.
  4. If all goes well, and the user's credintials pass; then REMOTE_USER environment variable is filled in and the AUTH_TYPE is listed as 'digest'.

Parameters:

application

The application object is called only upon successful authentication, and can assume environ['REMOTE_USER'] is set. If the REMOTE_USER is already set, this middleware is simply pass-through.

realm

This is a identifier for the authority that is requesting authorization. It is shown to the user and should be unique within the domain it is being used.

authfunc

This is a callback function which performs the actual authentication; the signature of this callback is:

authfunc(realm, username) -> hashcode

This module provides a 'digest_password' helper function which can help construct the hashcode; it is recommended that the hashcode is stored in a database, not the user's actual password (since you only need the hashcode).

This class contains 2 members.

C DigestUserSetter(...) ...

This class contains 2 members.

C TryToAddUsername(...) ...

This class contains 2 members.

C middleware(...) ...

middleware for HTTP Digest authentication (RFC 2617)

This component follows the procedure below:

  1. If the REMOTE_USER environment variable is already populated; then this middleware is a no-op, and the request is passed along to the application.
  2. If the HTTP_AUTHORIZATION header was not provided or specifies an algorithem other than digest, then a HTTPUnauthorized response is generated with the challenge.
  3. If the response is malformed or or if the user's credientials do not pass muster, another HTTPUnauthorized is raised.
  4. If all goes well, and the user's credintials pass; then REMOTE_USER environment variable is filled in and the AUTH_TYPE is listed as 'digest'.

Parameters:

application

The application object is called only upon successful authentication, and can assume environ['REMOTE_USER'] is set. If the REMOTE_USER is already set, this middleware is simply pass-through.

realm

This is a identifier for the authority that is requesting authorization. It is shown to the user and should be unique within the domain it is being used.

authfunc

This is a callback function which performs the actual authentication; the signature of this callback is:

authfunc(realm, username) -> hashcode

This module provides a 'digest_password' helper function which can help construct the hashcode; it is recommended that the hashcode is stored in a database, not the user's actual password (since you only need the hashcode).

This class contains 2 members.

See the source for more information.