コード例 #1
0
ファイル: credential.py プロジェクト: awesome-python/yosai
 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()
コード例 #2
0
ファイル: credential.py プロジェクト: zhill/yosai
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)
コード例 #3
0
ファイル: authc.py プロジェクト: awesome-python/yosai
    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
コード例 #4
0
    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
コード例 #5
0
ファイル: credential.py プロジェクト: zhill/yosai
 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]
コード例 #6
0
ファイル: conftest.py プロジェクト: hoatle/yosai
def patched_authc_settings(authc_config, monkeypatch):
    monkeypatch.setattr(settings, 'AUTHC_CONFIG', authc_config)
    return AuthenticationSettings()
コード例 #7
0
ファイル: conftest.py プロジェクト: hoatle/yosai
def cryptcontext_factory():
    authc_settings = AuthenticationSettings()
    return CryptContextFactory(authc_settings)
コード例 #8
0
def authc_settings(core_settings):
    return AuthenticationSettings(core_settings)