#NEWLINE# def __init__( self , appbuilder ) : #NEWLINE# #INDENT# super ( BaseSecurityManager , self ) . __init__ ( appbuilder ) #NEWLINE# app = self . appbuilder . get_app #NEWLINE# app . config . setdefault ( 'AUTH_ROLE_ADMIN' , 'Admin' ) #NEWLINE# app . config . setdefault ( 'AUTH_ROLE_PUBLIC' , 'Public' ) #NEWLINE# app . config . setdefault ( 'AUTH_TYPE' , AUTH_DB ) #NEWLINE# app . config . setdefault ( 'AUTH_USER_REGISTRATION' , False ) #NEWLINE# app . config . setdefault ( 'AUTH_USER_REGISTRATION_ROLE' , self . auth_role_public ) #NEWLINE# if ( self . auth_type == AUTH_LDAP ) : #NEWLINE# #INDENT# if ( 'AUTH_LDAP_SERVER' not in app . config ) : #NEWLINE# #INDENT# raise Exception ( 'No AUTH_LDAP_SERVER defined on config with AUTH_LDAP authentication type.' ) #NEWLINE# #UNINDENT# app . config . setdefault ( 'AUTH_LDAP_SEARCH' , '' ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_BIND_USER' , '' ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_BIND_PASSWORD' , '' ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_ALLOW_SELF_SIGNED' , False ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_UID_FIELD' , 'uid' ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_FIRSTNAME_FIELD' , 'givenName' ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_LASTNAME_FIELD' , 'sn' ) #NEWLINE# app . config . setdefault ( 'AUTH_LDAP_EMAIL_FIELD' , 'mail' ) #NEWLINE# #UNINDENT# if ( self . auth_type == AUTH_OID ) : #NEWLINE# #INDENT# self . oid = OpenID ( app ) #NEWLINE# #UNINDENT# if ( self . auth_type == AUTH_OAUTH ) : #NEWLINE# #INDENT# from flask_oauthlib.client import OAuth #NEWLINE# self . oauth = OAuth ( ) #NEWLINE# self . oauth_remotes = dict ( ) #NEWLINE# for _provider in self . oauth_providers : #NEWLINE# #INDENT# provider_name = _provider [ 'name' ] #NEWLINE# log . debug ( 'OAuth providers init {0}' . format ( provider_name ) ) #NEWLINE# obj_provider = self . oauth . remote_app ( provider_name , ** _provider [ 'remote_app' ] ) #NEWLINE# obj_provider . _tokengetter = self . oauth_tokengetter #NEWLINE# if ( not self . oauth_user_info ) : #NEWLINE# #INDENT# self . oauth_user_info = self . get_oauth_user_info #NEWLINE# #UNINDENT# self . oauth_remotes [ provider_name ] = obj_provider #NEWLINE# #UNINDENT# #UNINDENT# self . lm = LoginManager ( app ) #NEWLINE# self . lm . login_view = 'login' #NEWLINE# self . lm . user_loader ( appbuilder . load_user )