Exemple #1
0
def app_sessions(app):
    app.url_map.strict_slashes = False
    app.db = SQLAlchemyDriver(app.config["DB"])
    migrate(app.db)
    session = flask_scoped_session(app.db.Session, app)  # noqa
    app.storage_manager = StorageManager(
        app.config["STORAGE_CREDENTIALS"], logger=app.logger
    )
    enabled_idp_ids = app.config["ENABLED_IDENTITY_PROVIDERS"]["providers"].keys()
    # Add OIDC client for Google if configured.
    configured_google = (
        "OPENID_CONNECT" in app.config and "google" in app.config["OPENID_CONNECT"]
    )
    if configured_google:
        app.google_client = GoogleClient(
            app.config["OPENID_CONNECT"]["google"],
            HTTP_PROXY=app.config.get("HTTP_PROXY"),
            logger=app.logger,
        )
    # Add OIDC client for multi-tenant fence if configured.
    configured_fence = (
        "OPENID_CONNECT" in app.config
        and "fence" in app.config["OPENID_CONNECT"]
        and "fence" in enabled_idp_ids
    )
    if configured_fence:
        app.fence_client = OAuthClient(**app.config["OPENID_CONNECT"]["fence"])
    app.session_interface = UserSessionInterface()
    if app.config.get("ARBORIST"):
        app.arborist = ArboristClient(arborist_base_url=app.config["ARBORIST"])
Exemple #2
0
def app_sessions(app):
    app.url_map.strict_slashes = False
    app.db = SQLAlchemyDriver(config["DB"])

    # TODO: we will make a more robust migration system external from the application
    #       initialization soon
    if config["ENABLE_DB_MIGRATION"]:
        logger.info("Running database migration...")
        migrate(app.db)
        logger.info("Done running database migration.")
    else:
        logger.info("NOT running database migration.")

    session = flask_scoped_session(app.db.Session, app)  # noqa
    app.session_interface = UserSessionInterface()
Exemple #3
0
def app_sessions(app):
    app.url_map.strict_slashes = False
    app.db = SQLAlchemyDriver(app.config['DB'])
    migrate(app.db)
    session = flask_scoped_session(app.db.Session, app)  # noqa
    app.jinja_env.globals['csrf_token'] = generate_csrf_token
    app.storage_manager = StorageManager(
        app.config['STORAGE_CREDENTIALS'],
        logger=app.logger
    )
    enabled_idp_ids = (
        fence.settings
        .ENABLED_IDENTITY_PROVIDERS['providers']
        .keys()
    )
    # Add OIDC client for Google if configured.
    configured_google = (
        'OPENID_CONNECT' in app.config
        and 'google' in app.config['OPENID_CONNECT']
        and 'google' in enabled_idp_ids
    )
    if configured_google:
        app.google_client = GoogleClient(
            app.config['OPENID_CONNECT']['google'],
            HTTP_PROXY=app.config.get('HTTP_PROXY'),
            logger=app.logger
        )
    # Add OIDC client for multi-tenant fence if configured.
    configured_fence = (
        'OPENID_CONNECT' in app.config
        and 'fence' in app.config['OPENID_CONNECT']
        and 'fence' in enabled_idp_ids
    )
    if configured_fence:
        app.fence_client = OAuthClient(**app.config['OPENID_CONNECT']['fence'])
    app.session_interface = UserSessionInterface()
Exemple #4
0
def app_sessions(app):
    app.url_map.strict_slashes = False
    app.db = SQLAlchemyDriver(config["DB"])
    migrate(app.db)
    session = flask_scoped_session(app.db.Session, app)  # noqa
    app.session_interface = UserSessionInterface()