예제 #1
0
파일: entity.py 프로젝트: rohe/fedservice
def init_app(config_file, name=None, **kwargs) -> Flask:
    name = name or __name__
    app = Flask(name, static_url_path='', **kwargs)

    app.srv_config = create_from_config_file(Configuration,
                                             entity_conf=[{
                                                 "class":
                                                 FedEntityConfiguration,
                                                 "attr":
                                                 "federation",
                                                 "path": ["federation"]
                                             }],
                                             filename=config_file,
                                             base_path=dir_path)

    # app.users = {'test_user': {'name': 'Testing Name'}}

    try:
        from .views import intermediate
    except ImportError:
        from views import intermediate

    app.register_blueprint(intermediate)

    # Initialize the oidc_provider after views to be able to set correct urls
    app.server = init_entity(app.srv_config.federation, dir_path)

    return app
예제 #2
0
def oidc_provider_init_app(op_config, name=None, **kwargs):
    name = name or __name__
    app = Flask(name, static_url_path='', **kwargs)
    app.srv_config = op_config

    try:
        from .views import oidc_op_views
    except ImportError:
        from views import oidc_op_views

    app.register_blueprint(oidc_op_views)

    # Initialize the oidc_provider after views to be able to set correct urls
    app.server = init_oidc_op(app)

    return app