twisted.cred.checkers.FilePasswordDB class documentationtwisted.cred.checkers
(View In Hierarchy)
Implements interfaces: twisted.cred.checkers.ICredentialsChecker
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 | __init__ | |
| Method | __getstate__ | Undocumented | 
| Method | getUser | Look up the credentials for a username. | 
| Method | requestAvatarId | Validate credentials and produce an avatar ID. | 
| Method | _cbPasswordMatch | Undocumented | 
| Method | _loadCredentials | Loads the credentials from the configured file. | 
| Parameters | filename | The name of the file from which to read username and password information. (type: str) | 
| delim | The field delimiter used in the file. (type: bytes) | |
| usernameField | The index of the username after splitting a line on the delimiter. (type: int) | |
| passwordField | The index of the password after splitting a line on the delimiter. (type: int) | |
| caseSensitive | If true, consider the case of the username when performing a lookup.  
Ignore it otherwise. (type: bool) | |
| hash | 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. (type: Three-argument callable or None) | |
| cache | 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. (type: bool) | 
Loads the credentials from the configured file.
| Returns | An iterable of username, passwordcouples. (type:iterable) | |
| Raises | UnauthorizedLogin | when failing to read the credentials from the file. | 
Look up the credentials for a username.
| Parameters | username | The username to look up. (type: bytes) | 
| Returns | Two-tuple of the canonicalicalized username (i.e. lowercase if the database
is not case sensitive) and the associated password value, both bytes. (type:tuple) | |
| Raises | KeyError | When lookup of the username fails. | 
Validate credentials and produce an avatar ID.
| Parameters | credentials | something which implements one of the interfaces in credentialInterfaces. | 
| Returns | a Deferredwhich will fire with abytesthat identifies an avatar, an empty tuple to specify an authenticated 
anonymous user (provided astwisted.cred.checkers.ANONYMOUS)
or fail withUnauthorizedLogin.
Alternatively, return the result itself. | |
| See Also | twisted.cred.credentials | |