Exemple #1
0
def wsgi_app_v3(inner_app_v3=None,
                fake_auth_context=None,
                use_no_auth=False,
                ext_mgr=None,
                init_only=None):
    if not inner_app_v3:
        inner_app_v3 = compute.APIRouterV3(init_only)

    if use_no_auth:
        api_v3 = openstack_api.FaultWrapper(
            auth.NoAuthMiddlewareV3(
                limits.RateLimitingMiddleware(inner_app_v3)))
    else:
        if fake_auth_context is not None:
            ctxt = fake_auth_context
        else:
            ctxt = context.RequestContext('fake', 'fake', auth_token=True)
        api_v3 = openstack_api.FaultWrapper(
            api_auth.InjectContext(
                ctxt, limits.RateLimitingMiddleware(inner_app_v3)))

    mapper = urlmap.URLMap()
    mapper['/v3'] = api_v3
    # TODO(cyeoh): bp nova-api-core-as-extensions
    # Still need to implement versions for v3 API
    #    mapper['/'] = openstack_api.FaultWrapper(versions.Versions())
    return mapper
Exemple #2
0
def wsgi_app_v21(inner_app_v21=None,
                 fake_auth_context=None,
                 use_no_auth=False,
                 ext_mgr=None,
                 init_only=None):
    if not inner_app_v21:
        inner_app_v21 = compute.APIRouterV21(init_only)

    if use_no_auth:
        api_v21 = openstack_api.FaultWrapper(
            auth.NoAuthMiddlewareV3(
                limits.RateLimitingMiddleware(inner_app_v21)))
    else:
        if fake_auth_context is not None:
            ctxt = fake_auth_context
        else:
            ctxt = context.RequestContext('fake', 'fake', auth_token=True)
        api_v21 = openstack_api.FaultWrapper(
            api_auth.InjectContext(
                ctxt, limits.RateLimitingMiddleware(inner_app_v21)))

    mapper = urlmap.URLMap()
    mapper['/v2'] = api_v21
    mapper['/v2.1'] = api_v21
    return mapper
Exemple #3
0
 def setUp(self):
     super(TestNoAuthMiddlewareV3, self).setUp()
     api_router = compute.APIRouterV3()
     api_v3 = openstack_api.FaultWrapper(
         auth.NoAuthMiddlewareV3(api_router))
     self.wsgi_app = urlmap.URLMap()
     self.wsgi_app['/v3'] = api_v3
     self.req_url = '/v3'
     self.expected_url = "http://localhost/v3"