# 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.
import collections
import os
from oslo_log import log
import stevedore
try:
# werkzeug 0.15.x
from werkzeug.middleware import proxy_fix
except ImportError:
# werkzeug 0.14.x
from werkzeug.contrib import fixers as proxy_fix
from keystone.common import profiler
import keystone.conf
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:
# * "namespace": namespace for the entry_point
# * "ep": the entry-point name
# * "conf": extra config data for the entry_point (None or Dict)
_Middleware = collections.namedtuple('LoadableMiddleware',
'namespace, ep, conf')
CONF = keystone.conf.CONF
# NOTE(morgan): ORDER HERE IS IMPORTANT! The middleware will process the
# request in this list's order.
_APP_MIDDLEWARE = (
_Middleware(namespace='keystone.server_middleware',
ep='cors',
conf={'oslo_config_project': 'keystone'}),
_Middleware(namespace='keystone.server_middleware',
ep='sizelimit',
conf={}),
_Middleware(namespace='keystone.server_middleware',
ep='http_proxy_to_wsgi',
conf={}),
_Middleware(namespace='keystone.server_middleware',
ep='osprofiler',
conf={}),
_Middleware(namespace='keystone.server_middleware',
ep='request_id',
conf={}),
)
# NOTE(morgan): ORDER HERE IS IMPORTANT! Each of these middlewares are
# implemented/defined explicitly in Keystone Server. They do some level of
# lifting to ensure the request is properly handled. It is importat to note
# that these will be processed in the order of this list AND after all
# middleware defined in _APP_MIDDLEWARE. AuthContextMiddleware should always
# be the last element here as long as it is an actual Middleware.
_KEYSTONE_MIDDLEWARE = (
url_normalize.URLNormalizingMiddleware,
auth_context.AuthContextMiddleware,
)
def _get_config_files(env=None):
if env is None:
env = os.environ
dirname = env.get('OS_KEYSTONE_CONFIG_DIR', '').strip()
files = [s.strip() for s in
env.get('OS_KEYSTONE_CONFIG_FILES', '').split(';') if s.strip()]
if dirname:
if not files:
files = ['keystone.conf']
files = [os.path.join(dirname, fname) for fname in files]
return files
[docs]def setup_app_middleware(app):
# NOTE(morgan): Load the middleware, in reverse order, we wrap the app
# explicitly; reverse ordert to notestrip()]
ifdirname = ,">dirname = ,">dirname = ):<
">=
None, option parents = # NOTE(lhinds) This is marked as #nosec since bandit will see SHA1
les in conf.py */
var gitSha = "SHA: unknown";
var bugTitle = "keysto 29;: :
.prript type="text/javascript" src="../..358,">dirname . .list_projects_in_subtree
<list_projects_is="n">list_projects_in_subtree
<list_projects_is="n">list_projects_in_subtree
n">key in servicen">parent">()]=
'belong to.'=
&q.rt @sql'belong to.'=utils