user.auth.second_factor

Module Contents

Classes

YubikeyConfig

dict() -> new empty dictionary

SecondFactor

Base class and registry for secondary auth factors.

YubikeyFactor

Implements a yubikey factor for the Auth class.

Attributes

SECOND_FACTORS

class user.auth.second_factor.YubikeyConfig[source]

Bases: typing_extensions.TypedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

yubikey_client_id: str | None[source]
yubikey_secret_key: str | None[source]
user.auth.second_factor.SECOND_FACTORS: dict[str, type[SecondFactor]][source]
class user.auth.second_factor.SecondFactor[source]

Base class and registry for secondary auth factors.

__slots__ = ()[source]
classmethod __init_subclass__(type: str, **kwargs: Any)[source]
abstract classmethod configure(**cfg: Any) Self | None[source]

Initialises the auth factor using a dictionary that may or may not contain the configuration values necessary for the auth factor.

If the configuration is invalid None will be returned, otherwise a new instance is created.

All used configuration values should be popped, not just read.

abstract classmethod args_from_app(app: morepath.App) Mapping[str, Any][source]

Copies the required configuration values from the app, returning a dictionary with all keys present. The values should be either the ones from the application or None.

abstract is_valid(user_specific_config: Any, factor: str) bool[source]

Returns true if the given factor is valid for the given user-specific configuration. This is the value stored on the user in the second_factor column.

class user.auth.second_factor.YubikeyFactor(yubikey_client_id: str, yubikey_secret_key: str)[source]

Bases: SecondFactor

Implements a yubikey factor for the Auth class.

__slots__ = ('yubikey_client_id', 'yubikey_secret_key')[source]
classmethod configure(**cfg: Any) Self | None[source]

Initialises the auth factor using a dictionary that may or may not contain the configuration values necessary for the auth factor.

If the configuration is invalid None will be returned, otherwise a new instance is created.

All used configuration values should be popped, not just read.

classmethod args_from_app(app: morepath.App) YubikeyConfig[source]

Copies the required configuration values from the app, returning a dictionary with all keys present. The values should be either the ones from the application or None.

is_valid(user_specific_config: str, factor: str) bool[source]

Returns true if the given factor is valid for the given user-specific configuration. This is the value stored on the user in the second_factor column.