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`.`InMemoryUsernamePasswordDatabaseDontUse``

class documentation

`class InMemoryUsernamePasswordDatabaseDontUse: (source)`

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

View In Hierarchy

An extremely simple credentials checker.

This is only of use in one-off test programs or examples which don't want to focus too much on how credentials are verified.

You really don't want to use this for anything else. It is, at best, a toy. If you need a simple credentials checker for a real application, see `FilePasswordDB`.

Method | `__init__` | Initialize the in-memory database.
Method | `addUser` | Set a user's password.
Method | `requestAvatarId` | Validate credentials and produce an avatar ID.
Class Variable | `credentialInterfaces` | Tuple of `IUsernamePassword` and `IUsernameHashedPassword`.
Instance Variable | `users` | Mapping of usernames to passwords.
Method | `_cbPasswordMatch` | Undocumented

def __init__(self, **users): (source)

Initialize the in-memory database.

For example:

        db = InMemoryUsernamePasswordDatabaseDontUse(
            user1=b'sesame',
            user2=b'hunter2',
        )

Parameters
**users:`dict` of `str` to `bytes` | Usernames and passwords to seed the database with. Each username given as a keyword is encoded to `bytes` as ASCII. Passwords must be given as `bytes`.

def addUser(self, username, password): (source)

Set a user's password.

Parameters
username:`bytes` | Name of the user.
password:`bytes` | Password to associate with the username.

def requestAvatarId(self, credentials): (source)
from `twisted.cred.checkers.ICredentialsChecker`

Validate credentials and produce an avatar ID.

Parameters
credentials | something which implements one of the interfaces in `credentialInterfaces`.
Returns
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`

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

Tuple of `IUsernamePassword` and `IUsernameHashedPassword`.

users: `dict` mapping `bytes` to `bytes` = (source)

Mapping of usernames to passwords.

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

Undocumented