Ejemplo n.º 1
0
def init_blueprint(state):
    app = state.app

    action_mechanisms = {
        'static': ('.static_actions', 'StaticActions'),
    }
    app.actions = make_support_class(app, __name__, action_mechanisms,
                                     'RELENGAPI_ACTIONS',
                                     'static')
Ejemplo n.º 2
0
def init_blueprint(state):
    from relengapi import login_manager
    app = state.app

    @login_manager.user_loader
    def login_manager_user_loader(authenticated_email):
        return User(authenticated_email)

    # configure the login manager to redirect to a bare "please login" page when
    # a login is required
    login_manager.login_view = 'userauth.login_request'
    login_manager.login_message = 'Please authenticate to the Releng API before proceeding'
    login_manager.init_app(app)

    auth_mechanisms = {
        'browserid': ('.browserid', 'BrowserIDAuth'),
        'external': ('.external', 'ExternalAuth'),
    }
    app.auth = make_support_class(app, __name__, auth_mechanisms,
                                  'RELENGAPI_AUTHENTICATION',
                                  'browserid')