class documentation

class twisted.cred.checkers.FilePasswordDB: (source)

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.

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

Undocumented

_credCache = (source)

Undocumented

_cacheTimestamp = (source)

Undocumented

_log = (source)

Undocumented

def __init__(self, filename, delim=b':', usernameField=0, passwordField=1, caseSensitive=True, hash=None, cache=False): (source)
ParametersfilenameThe name of the file from which to read username and password information. (type: str)
delimThe field delimiter used in the file. (type: bytes)
usernameFieldThe index of the username after splitting a line on the delimiter. (type: int)
passwordFieldThe index of the password after splitting a line on the delimiter. (type: int)
caseSensitiveIf true, consider the case of the username when performing a lookup. Ignore it otherwise. (type: bool)
hashA 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. (type: Three-argument callable or None)
cacheIf 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. (type: bool)
filename = (source)

Undocumented

delim = (source)

Undocumented

ufield = (source)

Undocumented

pfield = (source)

Undocumented

caseSensitive = (source)

Undocumented

hash = (source)

Undocumented

credentialInterfaces = (source)

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

def __getstate__(self): (source)

Undocumented

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

Undocumented

def _loadCredentials(self): (source)

Loads the credentials from the configured file.

ReturnsAn iterable of username, password couples. (type: iterable)
RaisesUnauthorizedLoginwhen failing to read the credentials from the file.
def getUser(self, username): (source)

Look up the credentials for a username.

ParametersusernameThe username to look up. (type: bytes)
ReturnsTwo-tuple of the canonicalicalized username (i.e. lowercase if the database is not case sensitive) and the associated password value, both bytes. (type: tuple)
RaisesKeyErrorWhen lookup of the username fails.
def requestAvatarId(self, c): (source)

Validate credentials and produce an avatar ID.

ParameterscUndocumented
credentialssomething which implements one of the interfaces in credentialInterfaces.
Returnsa 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 Alsotwisted.cred.credentials
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.