Move AuthContextMiddleware

Move AuthContextMiddleware to keystone.server.flask.request_processing
to be more in line with the other internally defined middleware.

Change-Id: I25b6a88f4b0dc3af306360ee4e5ec0abfe3cf812
Partial-Bug: #1776504
This commit is contained in:
Morgan Fainberg 2018-10-11 13:59:58 -07:00
parent 848c8fa638
commit 595967bba6
5 changed files with 6 additions and 21 deletions

View File

@ -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

View File

@ -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,
)

View File

@ -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()

View File

@ -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