Package httxlib :: Module httxauth
[hide private]
[frames] | no frames]

Module httxauth

source code

Authentication functions to answer to Basic and Digest HTTP authentication challenges

Functions [hide private]
tuple (str, str|None)
authbasic(username, password, authchallenge)
Given a username and a password return an HTTP Basic Authentication challenge.
source code
tuple (str|None, str|None)
authdigest(username, password, challenge, request, nonce_count)
Given a username, password, a list of challenge fields, a request a sequence number (nonce_count) return a Diget Auth challenge answer
source code
Variables [hide private]
  __package__ = 'httxlib'
Function Details [hide private]

authbasic(username, password, authchallenge)

source code 

Given a username and a password return an HTTP Basic Authentication challenge.

The authchallenge parameter is just for harmony with authdigest and for potentially defining a plug-in interface for other authentications

Parameters:
  • username (str) - The username to reply to the challenge
  • password (str) - The password to reply to the challenge
Returns: tuple (str, str|None)
A tuple containing a base64 encoded challenge and a string with a cache-able challenge for future responses The second value can be None

authdigest(username, password, challenge, request, nonce_count)

source code 

Given a username, password, a list of challenge fields, a request a sequence number (nonce_count) return a Diget Auth challenge answer

If username is None, then challenge will contain a username key with the username and the password parameter will be the cached value of the HA1 (see the function below) to be used

Parameters:
  • username (str|None) - The username to reply to the challenge or None to indicate that the password contains a HA1 cache
  • password (str) - The password to reply to the challenge or a HA1 cache
  • challenge (dict) - Dictionary with the parameters in the challenge
  • request (HttxRequest) - The request that has generated the auth challenge
  • nonce_count (int) - Sequence value if this not the first time such a request has been seen. Used by Digest auth to prevent replay attacks
Returns: tuple (str|None, str|None)
A tuple containing a digest answer and a string with a cache-able challenge for future responses Both values can be None if a specific non-supported variant of the Digest Auth is used