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, endpoint_policy_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) 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)
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)
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) ])
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()])
def public_app_factory(global_conf, **local_conf): controllers.register_version('v2.0') return wsgi.ComposingRouter(routes.Mapper(), [assignment_routers.Public(), token_routers.Router(), routers.VersionV2('public'), routers.Extension(False)])
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)
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')])
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
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()])
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()])
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
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)