Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`cred`.`credentials`.`DigestCredentialFactory``

class documentation

`class DigestCredentialFactory: (source)`

Constructor: `DigestCredentialFactory(algorithm, authenticationRealm)`

View In Hierarchy

Support for RFC2617 HTTP Digest Authentication

Parameters
algorithm | Case insensitive string specifying the hash algorithm to use. Must be either `'md5'` or `'sha'`. `'md5-sess'` is not supported.
authenticationRealm | case sensitive string that specifies the realm portion of the challenge

Method | `__init__` | Undocumented
Method | `decode` | Decode the given response and attempt to generate a `DigestedCredentials` from it.
Method | `getChallenge` | Generate the challenge for use in the WWW-Authenticate header.
Constant | `CHALLENGE_LIFETIME_SECS` | The number of seconds for which an opaque should be valid.
Class Variable | `scheme` | Undocumented
Instance Variable | `algorithm` | Undocumented
Instance Variable | `authenticationRealm` | Undocumented
Instance Variable | `privateKey` | A random string used for generating the secure opaque.
Method | `_generateNonce` | Create a random value suitable for use as the nonce parameter of a WWW-Authenticate challenge.
Method | `_generateOpaque` | Generate an opaque to be returned to the client. This is a unique string that can be returned to us and verified.
Method | `_getTime` | Parameterize the time based seed used in `_generateOpaque` so we can deterministically unittest it's behavior.
Method | `_verifyOpaque` | Given the opaque and nonce from the request, as well as the client IP that made the request, verify that the opaque was generated by us. And that it's not too old.
Class Variable | `_parseparts` | Undocumented

def __init__(self, algorithm, authenticationRealm): (source)

Undocumented

def decode(self, response, method, host): (source)

Decode the given response and attempt to generate a `DigestedCredentials` from it.

Parameters
response:`bytes` | A string of comma separated key=value pairs
method:`bytes` | The action requested to which this response is addressed (GET, POST, INVITE, OPTIONS, etc).
host:`bytes` | The address the request was sent from.
Returns
`DigestedCredentials`
Raises
`error.LoginFailed` | If the response does not contain a username, a nonce, an opaque, or if the opaque is invalid.

def getChallenge(self, address): (source)

Generate the challenge for use in the WWW-Authenticate header.

Parameters
address | The client address to which this challenge is being sent.
Returns
The `dict` that can be used to generate a WWW-Authenticate header.

CHALLENGE_LIFETIME_SECS = (source)

The number of seconds for which an opaque should be valid.

Value

    15*60

scheme: `bytes` = (source)

Undocumented

algorithm: `bytes` = (source)

Undocumented

authenticationRealm: `bytes` = (source)

Undocumented

privateKey: `bytes` = (source)

A random string used for generating the secure opaque.

def _generateNonce(self): (source)

Create a random value suitable for use as the nonce parameter of a WWW-Authenticate challenge.

Returns
`bytes` | Undocumented

def _generateOpaque(self, nonce, clientip): (source)

Generate an opaque to be returned to the client. This is a unique string that can be returned to us and verified.

def _getTime(self): (source)

Parameterize the time based seed used in `_generateOpaque` so we can deterministically unittest it's behavior.

def _verifyOpaque(self, opaque, nonce, clientip): (source)

Given the opaque and nonce from the request, as well as the client IP that made the request, verify that the opaque was generated by us. And that it's not too old.

Parameters
opaque | The opaque value from the Digest response
nonce | The nonce value from the Digest response
clientip | The remote IP address of the client making the request or `None` if the request was submitted over a channel where this does not make sense.
Returns
`True` if the opaque was successfully verified.
Raises
`error.LoginFailed` | if `opaque` could not be parsed or contained the wrong values.

_parseparts = (source)

Undocumented