Example #1
0
File: mgt.py Project: hoatle/yosai
    def __init__(self,
                 realms=None,
                 event_bus=event_bus,
                 cache_handler=None,
                 authenticator=DefaultAuthenticator(),
                 authorizer=ModularRealmAuthorizer(),
                 session_manager=DefaultNativeSessionManager(),
                 session_attributes_schema=None,
                 remember_me_manager=None,
                 subject_store=DefaultSubjectStore(),  # unlike shiro, yosai defaults
                 subject_factory=DefaultSubjectFactory(),  # unlike shiro, yosai defaults
                 authz_info_resolver=AuthzInfoResolver(IndexedAuthorizationInfo),
                 credential_resolver=CredentialResolver(Credential),
                 permission_resolver=PermissionResolver(DefaultPermission),
                 role_resolver=RoleResolver(SimpleRole)):
        """
        :type realms: tuple
        :type session_attributes_schema: marshmallow.Schema
        """
        self._event_bus = event_bus
        self._cache_handler = cache_handler
        self.authz_info_resolver = authz_info_resolver
        self.credential_resolver = credential_resolver
        self.permission_resolver = permission_resolver
        self.role_resolver = role_resolver
        self.session_manager = session_manager
        self.realms = realms
        self.authenticator = authenticator
        self.authorizer = authorizer
        self.remember_me_manager = remember_me_manager
        self.subject_store = subject_store
        self.subject_factory = subject_factory

        if session_attributes_schema:
            SimpleSession.set_attributes_schema(session_attributes_schema)
Example #2
0
    def __init__(self,
                 yosai,
                 settings,
                 realms=None,
                 cache_handler=None,
                 authenticator=None,
                 authorizer=ModularRealmAuthorizer(),
                 serialization_manager=None,
                 session_manager=None,
                 remember_me_manager=None,
                 subject_store=DefaultSubjectStore()):

        self.yosai = yosai
        self.subject_store = subject_store
        self.realms = realms
        self.remember_me_manager = remember_me_manager

        if not session_manager:
            session_manager = NativeSessionManager(settings)
        self.session_manager = session_manager

        self.authorizer = authorizer

        if not authenticator:
            authenticator = DefaultAuthenticator(settings)
        self.authenticator = authenticator

        if serialization_manager and self.remember_me_manager:
            self.remember_me_manager.serialization_manager = serialization_manager

        self.event_logger = EventLogger(event_bus)
        self.apply_event_bus(event_bus)

        self.apply_cache_handler(cache_handler)
        self.apply_realms()
Example #3
0
def default_authenticator(core_settings):
    return DefaultAuthenticator(core_settings)
Example #4
0
def default_authenticator(account_store_realm, event_bus, settings):
    da = DefaultAuthenticator(settings)
    da.event_bus = event_bus
    da.init_realms((account_store_realm, ))
    return da
Example #5
0
def default_authenticator(
        first_realm_successful_strategy, monkeypatch, default_accountstorerealm):
    da = DefaultAuthenticator(first_realm_successful_strategy)
    da.event_bus = event_bus
    da.realms = (default_accountstorerealm,)
    return da
Example #6
0
def default_authenticator(first_realm_successful_strategy, monkeypatch,
                          default_accountstorerealm):
    da = DefaultAuthenticator(first_realm_successful_strategy)
    da.event_bus = event_bus
    da.realms = (default_accountstorerealm, )
    return da
Example #7
0
def default_authenticator(account_store_realm, credential_resolver):
    da = DefaultAuthenticator()
    account_store_realm.credential_resolver = credential_resolver
    da.realms = (account_store_realm, )
    da.event_bus = event_bus
    return da