diff --git a/keystone/middleware/__init__.py b/keystone/middleware/__init__.py deleted file mode 100644 index f239db97b4..0000000000 --- a/keystone/middleware/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2012 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from keystone.middleware.auth import * # noqa diff --git a/keystone/server/flask/core.py b/keystone/server/flask/core.py index d5c4506e3f..a7dc47af20 100644 --- a/keystone/server/flask/core.py +++ b/keystone/server/flask/core.py @@ -27,9 +27,9 @@ oslo_i18n.enable_lazy() from keystone.common import profiler import keystone.conf -import keystone.middleware import keystone.server from keystone.server.flask import application +from keystone.server.flask.request_processing.middleware import auth_context from keystone.server.flask.request_processing.middleware import url_normalize # NOTE(morgan): Middleware Named Tuple with the following values: @@ -69,7 +69,7 @@ _APP_MIDDLEWARE = ( # be the last element here as long as it is an actual Middleware. _KEYSTONE_MIDDLEWARE = ( url_normalize.URLNormalizingMiddleware, - keystone.middleware.AuthContextMiddleware, + auth_context.AuthContextMiddleware, ) diff --git a/keystone/middleware/auth.py b/keystone/server/flask/request_processing/middleware/auth_context.py similarity index 100% rename from keystone/middleware/auth.py rename to keystone/server/flask/request_processing/middleware/auth_context.py diff --git a/keystone/tests/unit/test_middleware.py b/keystone/tests/unit/test_middleware.py index d1a21a4fd0..1927ec45bc 100644 --- a/keystone/tests/unit/test_middleware.py +++ b/keystone/tests/unit/test_middleware.py @@ -27,7 +27,7 @@ from keystone.common import wsgi import keystone.conf from keystone import exception from keystone.federation import constants as federation_constants -from keystone import middleware +from keystone.server.flask.request_processing.middleware import auth_context from keystone.tests import unit from keystone.tests.unit import mapping_fixtures from keystone.tests.unit import test_backend_sql @@ -106,7 +106,7 @@ class MiddlewareRequestTestBase(unit.TestCase): class AuthContextMiddlewareTest(test_backend_sql.SqlTests, MiddlewareRequestTestBase): - MIDDLEWARE_CLASS = middleware.AuthContextMiddleware + MIDDLEWARE_CLASS = auth_context.AuthContextMiddleware def setUp(self): super(AuthContextMiddlewareTest, self).setUp() diff --git a/keystone/tests/unit/test_v3.py b/keystone/tests/unit/test_v3.py index 9e971a9107..4161ce2db6 100644 --- a/keystone/tests/unit/test_v3.py +++ b/keystone/tests/unit/test_v3.py @@ -26,8 +26,8 @@ from keystone.common import cache from keystone.common import provider_api from keystone.common.validation import validators from keystone import exception -from keystone import middleware from keystone.resource.backends import base as resource_base +from keystone.server.flask.request_processing.middleware import auth_context from keystone.tests.common import auth as common_auth from keystone.tests import unit from keystone.tests.unit import rest @@ -1239,7 +1239,7 @@ class AuthContextMiddlewareTestCase(RestfulTestCase): start_response('200 OK', headers) return [body] - app = webtest.TestApp(middleware.AuthContextMiddleware(application), + app = webtest.TestApp(auth_context.AuthContextMiddleware(application), extra_environ=extra_environ) resp = app.get('/', headers={authorization.AUTH_TOKEN_HEADER: token}) self.assertEqual(b'body', resp.body) # just to make sure it worked