コード例 #1
0
ファイル: application.py プロジェクト: xhan-shannon/keystone
def application_factory(name='public'):
    if name not in ('admin', 'public'):
        raise RuntimeError('Application name (for base_url lookup) must be '
                           'either `admin` or `public`.')

    # NOTE(morgan): The Flask App actually dispatches nothing until we migrate
    # some routers to Flask-Blueprints, it is simply a placeholder.
    app = flask.Flask(name)

    # TODO(morgan): Convert Subsystems over to Flask-Native, for now, we simply
    # dispatch to another "application" [e.g "keystone"]
    # NOTE(morgan): as each router is converted to flask-native blueprint,
    # remove from this list. WARNING ORDER MATTERS; ordered dict used to
    # ensure sane ordering of the routers in the legacy-dispatch model.
    dispatch_map = collections.OrderedDict()

    # Load in Healthcheck and map it to /healthcheck
    hc_app = healthcheck.Healthcheck.app_factory(
        {}, oslo_config_project='keystone')
    dispatch_map['/healthcheck'] = hc_app

    # More legacy code to instantiate all the magic for the dispatchers.
    # The move to blueprints (FLASK) will allow this to be eliminated.
    _routers = []
    sub_routers = []
    mapper = routes.Mapper()
    for api_routers in ALL_API_ROUTERS:
        routers_instance = api_routers.Routers()
        _routers.append(routers_instance)
        routers_instance.append_v3_routers(mapper, sub_routers)

    # Add in the v3 version api
    sub_routers.append(version_routers.VersionV3('public', _routers))
    version_controllers.register_version('v3')
    legacy_dispatcher = keystone_wsgi.ComposingRouter(mapper, sub_routers)

    for pfx in itertools.chain(
            *[rtr.Routers._path_prefixes for rtr in ALL_API_ROUTERS]):
        dispatch_map['/v3/%s' % pfx] = legacy_dispatcher

    # NOTE(morgan) Move the version routers to Flask Native First! It will
    # not work well due to how the dispatcher works unless this is first,
    # otherwise nothing falls through to the native flask app.
    dispatch_map['/v3'] = legacy_dispatcher

    # NOTE(morgan): The Root Version Discovery Document is special and needs
    # it's own mapper/router since the v3 one assumes it owns the root due
    # to legacy paste-isms where /v3 would be routed to APP=/v3, PATH=/
    root_version_disc_mapper = routes.Mapper()
    root_version_disc_router = version_routers.Versions(name)
    root_dispatcher = keystone_wsgi.ComposingRouter(root_version_disc_mapper,
                                                    [root_version_disc_router])
    dispatch_map['/'] = root_dispatcher

    application = KeystoneDispatcherMiddleware(app, dispatch_map)
    return application
コード例 #2
0
ファイル: service.py プロジェクト: frank6866/keystone
def v3_app_factory(global_conf, **local_conf):
    controllers.register_version('v3')
    mapper = routes.Mapper()
    sub_routers = []
    _routers = []

    # NOTE(dstanek): Routers should be ordered by their frequency of use in
    # a live system. This is due to the routes implementation. The most
    # frequently used routers should appear first.
    router_modules = [
        auth, assignment, catalog, credential, identity, policy, resource,
        revoke, federation, oauth1
    ]

    if CONF.trust.enabled:
        router_modules.append(trust)

    if CONF.endpoint_policy.enabled:
        router_modules.append(endpoint_policy)

    for module in router_modules:
        routers_instance = module.routers.Routers()
        _routers.append(routers_instance)
        routers_instance.append_v3_routers(mapper, sub_routers)

    # Add in the v3 version api
    sub_routers.append(routers.VersionV3('public', _routers))
    return wsgi.ComposingRouter(mapper, sub_routers)
コード例 #3
0
ファイル: service.py プロジェクト: xty19/keystone
def admin_app_factory(global_conf, **local_conf):
    controllers.register_version('v2.0')
    return wsgi.ComposingRouter(
        routes.Mapper(),
        [admin_crud.Router(),
         routers.VersionV2('admin'),
         routers.Extension()])
コード例 #4
0
ファイル: service.py プロジェクト: xty19/keystone
def public_app_factory(global_conf, **local_conf):
    controllers.register_version('v2.0')
    return wsgi.ComposingRouter(routes.Mapper(), [
        assignment_routers.Public(),
        routers.VersionV2('public'),
        routers.Extension(False)
    ])
コード例 #5
0
ファイル: service.py プロジェクト: townbull/keystone-dtrust
def admin_app_factory(global_conf, **local_conf):
    return wsgi.ComposingRouter(routes.Mapper(),
                                [identity.routers.Admin(),
                                 assignment.routers.Admin(),
                                    token.routers.Router(),
                                    routers.VersionV2('admin'),
                                    routers.Extension()])
コード例 #6
0
def application_factory(name='public'):
    if name not in ('admin', 'public'):
        raise RuntimeError('Application name (for base_url lookup) must be '
                           'either `admin` or `public`.')

    # NOTE(morgan): The Flask App actually dispatches nothing until we migrate
    # some routers to Flask-Blueprints, it is simply a placeholder.
    app = flask.Flask(name)
    app.after_request(_add_vary_x_auth_token_header)

    # NOTE(morgan): Configure the Flask Environment for our needs.
    app.config.update(
        # We want to bubble up Flask Exceptions (for now)
        PROPAGATE_EXCEPTIONS=True)

    # TODO(morgan): Convert Subsystems over to Flask-Native, for now, we simply
    # dispatch to another "application" [e.g "keystone"]
    # NOTE(morgan): as each router is converted to flask-native blueprint,
    # remove from this list. WARNING ORDER MATTERS; ordered dict used to
    # ensure sane ordering of the routers in the legacy-dispatch model.
    dispatch_map = collections.OrderedDict()

    # Load in Healthcheck and map it to /healthcheck
    hc_app = healthcheck.Healthcheck.app_factory(
        {}, oslo_config_project='keystone')
    dispatch_map['/healthcheck'] = hc_app

    # More legacy code to instantiate all the magic for the dispatchers.
    # The move to blueprints (FLASK) will allow this to be eliminated.
    _routers = []
    sub_routers = []
    mapper = routes.Mapper()
    for api_routers in ALL_API_ROUTERS:
        routers_instance = api_routers.Routers()
        _routers.append(routers_instance)
        routers_instance.append_v3_routers(mapper, sub_routers)

    # TODO(morgan): Remove "API version registration". For now this is kept
    # for ease of conversion (minimal changes)
    keystone.api.discovery.register_version('v3')

    # NOTE(morgan): We add in all the keystone.api blueprints here, this
    # replaces (as they are implemented) the legacy dispatcher work.
    for api in keystone.api.__apis__:
        for api_bp in api.APIs:
            api_bp.instantiate_and_register_to_app(app)

    # Build and construct the dispatching for the Legacy dispatching model
    sub_routers.append(_ComposibleRouterStub(_routers))
    legacy_dispatcher = keystone_wsgi.ComposingRouter(mapper, sub_routers)

    for pfx in itertools.chain(*[rtr.Routers._path_prefixes for
                                 rtr in ALL_API_ROUTERS]):
        dispatch_map['/v3/%s' % pfx] = legacy_dispatcher

    app.wsgi_app = KeystoneDispatcherMiddleware(
        app.wsgi_app,
        dispatch_map)
    return app
コード例 #7
0
ファイル: service.py プロジェクト: aboumawada/keystone
def admin_app_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)
    return wsgi.ComposingRouter(routes.Mapper(),
                                [identity.routers.Admin(),
                                    token.routers.Router(),
                                    routers.VersionV2('admin'),
                                    routers.Extension()])
コード例 #8
0
ファイル: service.py プロジェクト: zhanghaijie01/keystone
def admin_app_factory(global_conf, **local_conf):
    controllers.register_version('v2.0')
    # NOTE(lbragstad): Only wire up the v2.0 version controller. We should keep
    # this here because we still support the ec2tokens API on the v2.0 path
    # until T. Once that is removed, we can remove the rest of the v2.0 routers
    # and whatnot. The ec2token controller is actually wired up by the paste
    # pipeline.
    return wsgi.ComposingRouter(routes.Mapper(), [routers.VersionV2('admin')])
コード例 #9
0
ファイル: service.py プロジェクト: craftlk/keystone
def admin_app_factory(global_conf, **local_conf):
    controllers.register_version('v2.0')
    return wsgi.ComposingRouter(routes.Mapper(),
                                [identity.routers.Admin(),
                                 assignment.routers.Admin(),
                                 token.routers.Router(),
                                 resource.routers.Admin(),
                                 routers.VersionV2('admin'),
                                 routers.Extension()])
コード例 #10
0
ファイル: service.py プロジェクト: zhangheng1442/openstack
def public_app_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)
    return wsgi.ComposingRouter(routes.Mapper(), [
        identity.routers.Public(),
        token.routers.Router(),
        routers.VersionV2('public'),
        routers.Extension(False)
    ])
コード例 #11
0
ファイル: service.py プロジェクト: townbull/keystone-dtrust
def v3_app_factory(global_conf, **local_conf):
    controllers.register_version('v3')
    mapper = routes.Mapper()
    v3routers = []
    for module in [assignment, auth, catalog, credential, identity, policy]:
        module.routers.append_v3_routers(mapper, v3routers)

    if CONF.trust.enabled:
        trust.routers.append_v3_routers(mapper, v3routers)

    # Add in the v3 version api
    v3routers.append(routers.VersionV3('admin'))
    v3routers.append(routers.VersionV3('public'))
    # TODO(ayoung): put token routes here
    return wsgi.ComposingRouter(mapper, v3routers)
コード例 #12
0
ファイル: service.py プロジェクト: zhangheng1442/openstack
def v3_app_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)
    mapper = routes.Mapper()
    v3routers = []
    for module in [auth, catalog, identity, policy]:
        module.routers.append_v3_routers(mapper, v3routers)

    if CONF.trust.enabled:
        trust.routers.append_v3_routers(mapper, v3routers)

    # Add in the v3 version api
    v3routers.append(routers.VersionV3('admin'))
    v3routers.append(routers.VersionV3('public'))
    # TODO(ayoung): put token routes here
    return wsgi.ComposingRouter(mapper, v3routers)
コード例 #13
0
def v3_app_factory(global_conf, **local_conf):
    controllers.register_version('v3')
    mapper = routes.Mapper()
    sub_routers = []
    _routers = []

    router_modules = [assignment, auth, catalog, credential, identity, policy]
    if CONF.trust.enabled:
        router_modules.append(trust)

    for module in router_modules:
        routers_instance = module.routers.Routers()
        _routers.append(routers_instance)
        routers_instance.append_v3_routers(mapper, sub_routers)

    # Add in the v3 version api
    sub_routers.append(routers.VersionV3('public', _routers))
    return wsgi.ComposingRouter(mapper, sub_routers)
コード例 #14
0
ファイル: service.py プロジェクト: bopopescu/dashboard
def v3_app_factory(global_conf, **local_conf):
    controllers.register_version('v3')
    mapper = routes.Mapper()
    sub_routers = []
    _routers = []

    # NOTE(dstanek): Routers should be ordered by their frequency of use in
    # a live system. This is due to the routes implementation. The most
    # frequently used routers should appear first.
    all_api_routers = [
        auth_routers,
        assignment_routers,
        catalog_routers,
        credential_routers,
        identity_routers,
        policy_routers,
        resource_routers,
        revoke_routers,
        federation_routers,
        oauth1_routers,
        # TODO(morganfainberg): Remove the simple_cert router
        # when PKI and PKIZ tokens are removed.
        simple_cert_ext
    ]

    if CONF.trust.enabled:
        all_api_routers.append(trust_routers)

    if CONF.endpoint_policy.enabled:
        all_api_routers.append(endpoint_policy_routers)

    for api_routers in all_api_routers:
        routers_instance = api_routers.Routers()
        _routers.append(routers_instance)
        routers_instance.append_v3_routers(mapper, sub_routers)

    # Add in the v3 version api
    sub_routers.append(routers.VersionV3('public', _routers))
    return wsgi.ComposingRouter(mapper, sub_routers)
コード例 #15
0
ファイル: service.py プロジェクト: sliranc/keystone
def admin_version_app_factory(global_conf, **local_conf):
    conf = global_conf.copy()
    conf.update(local_conf)
    return wsgi.ComposingRouter(routes.Mapper(), [routers.Versions('admin')])
コード例 #16
0
def admin_version_app_factory(global_conf, **local_conf):
    return wsgi.ComposingRouter(routes.Mapper(), [routers.Versions('admin')])
コード例 #17
0
def moon_app_factory(global_conf, **local_conf):
    return wsgi.ComposingRouter(routes.Mapper(), [Routers('moon_service')])