def __init__(self, settings): authc_settings = AuthenticationSettings(settings) self.password_cc = self.create_password_crypt_context(authc_settings) self.totp_cc = self.create_totp_crypt_context(authc_settings) self.cc_token_resolver = {UsernamePasswordToken: self.password_cc, TOTPToken: self.totp_cc} self.supported_tokens = self.cc_token_resolver.keys()
def create_totp_factory(env_var=None, file_path=None, authc_settings=None): if not authc_settings: yosai_settings = LazySettings(env_var=env_var, file_path=file_path) authc_settings = AuthenticationSettings(yosai_settings) totp_context = authc_settings.totp_context return TOTP.using(**totp_context)
def __init__(self, settings, strategy=first_realm_successful_strategy): self.authc_settings = AuthenticationSettings(settings) self.authentication_strategy = strategy if self.authc_settings.mfa_challenger: self.mfa_challenger = self.authc_settings.mfa_challenger() self.realms = None self.token_realm_resolver = None self.locking_realm = None self.locking_limit = None self.event_bus = None
def __init__(self, settings, strategy=first_realm_successful_strategy): self.authc_settings = AuthenticationSettings(settings) self.authentication_strategy = strategy try: self.mfa_dispatcher = self.authc_settings.\ mfa_dispatcher(self.authc_settings.mfa_dispatcher_config) except TypeError: self.mfa_dispatcher = None self.realms = None self.token_realm_resolver = None self.locking_realm = None self.locking_limit = None self.event_bus = None
def __init__(self, settings): authc_settings = AuthenticationSettings(settings) self.password_cc = self.create_password_crypt_context(authc_settings) self.totp_factory = create_totp_factory(authc_settings=authc_settings) self.supported_tokens = [UsernamePasswordToken, TOTPToken]
def patched_authc_settings(authc_config, monkeypatch): monkeypatch.setattr(settings, 'AUTHC_CONFIG', authc_config) return AuthenticationSettings()
def cryptcontext_factory(): authc_settings = AuthenticationSettings() return CryptContextFactory(authc_settings)
def authc_settings(core_settings): return AuthenticationSettings(core_settings)