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`.`checkers`.`FilePasswordDB``

class documentation

`class FilePasswordDB: (source)`

Constructor: `FilePasswordDB(filename, delim, usernameField, passwordField, ...)`

Implements interfaces: `twisted.cred.checkers.ICredentialsChecker`

View In Hierarchy

A file-based, text-based username/password database.

Records in the datafile for this class are delimited by a particular string. The username appears in a fixed field of the columns delimited by this string, as does the password. Both fields are specifiable. If the passwords are not stored plaintext, a hash function must be supplied to convert plaintext passwords to the form stored on disk and this CredentialsChecker will only be able to check `IUsernamePassword` credentials. If the passwords are stored plaintext, `IUsernameHashedPassword` credentials will be checkable as well.

Method | `__getstate__` | Undocumented
Method | `__init__` | No summary
Method | `getUser` | Look up the credentials for a username.
Method | `requestAvatarId` | Validate credentials and produce an avatar ID.
Instance Variable | `cache` | Undocumented
Instance Variable | `caseSensitive` | Undocumented
Instance Variable | `credentialInterfaces` | A list of sub-interfaces of `ICredentials` which specifies which I may check.
Instance Variable | `delim` | Undocumented
Instance Variable | `filename` | Undocumented
Instance Variable | `hash` | Undocumented
Instance Variable | `pfield` | Undocumented
Instance Variable | `ufield` | Undocumented
Method | `_cbPasswordMatch` | Undocumented
Method | `_loadCredentials` | Loads the credentials from the configured file.
Class Variable | `_log` | Undocumented
Instance Variable | `_cacheTimestamp` | Undocumented
Instance Variable | `_credCache` | Undocumented

def __getstate__(self): (source)

Undocumented

def __init__(self, filename, delim=b':', usernameField=0, passwordField=1, caseSensitive=True, hash=None, cache=False): (source)

Parameters
filename:`str` | The name of the file from which to read username and password information.
delim:`bytes` | The field delimiter used in the file.
usernameField:`int` | The index of the username after splitting a line on the delimiter.
passwordField:`int` | The index of the password after splitting a line on the delimiter.
caseSensitive:`bool` | If true, consider the case of the username when performing a lookup. Ignore it otherwise.

hash:Three-argument callable or `None`

A function used to transform the plaintext password received over the network to a format suitable for comparison against the version stored on disk. The arguments to the callable are the username, the network-supplied password, and the in-file version of the password. If the return value compares equal to the version stored on disk, the credentials are accepted.

cache:`bool` | If true, maintain an in-memory cache of the contents of the password file. On lookups, the mtime of the file will be checked, and the file will only be re-parsed if the mtime is newer than when the cache was generated.

def getUser(self, username: `bytes`) -> `Tuple[bytes, bytes]`: (source)

Look up the credentials for a username.

Parameters
username:`bytes` | The username to look up.
Returns
`tuple` | Two-tuple of the canonicalicalized username (i.e. lowercase if the database is not case sensitive) and the associated password value, both `bytes`.
Raises
`KeyError` | When lookup of the username fails.

def requestAvatarId(self, credentials: `IUsernamePassword`) -> `Deferred[Union[bytes, Tuple[]]]`: (source)
from `twisted.cred.checkers.ICredentialsChecker`

Validate credentials and produce an avatar ID.

Parameters
credentials:`IUsernamePassword` | something which implements one of the interfaces in `credentialInterfaces`.
Returns
`Deferred[Union[bytes, Tuple[]]]` | a `Deferred` which will fire with a `bytes` that identifies an avatar, an empty tuple to specify an authenticated anonymous user (provided as `twisted.cred.checkers.ANONYMOUS`) or fail with `UnauthorizedLogin`. Alternatively, return the result itself.
See Also
`twisted.cred.credentials`

cache = (source)

Undocumented

caseSensitive = (source)

Undocumented

credentialInterfaces = (source)
from `twisted.cred.checkers.ICredentialsChecker`

A list of sub-interfaces of `ICredentials` which specifies which I may check.

delim = (source)

Undocumented

filename = (source)

Undocumented

hash = (source)

Undocumented

pfield = (source)

Undocumented

ufield = (source)

Undocumented

def _cbPasswordMatch(self, matched, username): (source)

Undocumented

def _loadCredentials(self): (source)

Loads the credentials from the configured file.

Returns
`iterable` | An iterable of `username, password` couples.
Raises
`UnauthorizedLogin` | when failing to read the credentials from the file.

_log = (source)

Undocumented

_cacheTimestamp: `float` = (source)

Undocumented

_credCache: `Optional[Dict[bytes, bytes]]` = (source)

Undocumented