diff options
author | 2015-09-24 16:27:16 +0200 | |
---|---|---|
committer | 2015-09-24 16:27:16 +0200 | |
commit | 92d11d139e9f76d4fd76859aea78643fc32ef36b (patch) | |
tree | bd5a2e7b50853498074ab55bdaee4452c460010b /keystone-moon/keystone/server/wsgi.py | |
parent | 49325d99acfadaadfad99c596c4ada6b5ec849de (diff) |
Update Keystone code from repository.
Change-Id: Ib3d0a06b10902fcc6d520f58e85aa617bc326d00
Diffstat (limited to 'keystone-moon/keystone/server/wsgi.py')
-rw-r--r-- | keystone-moon/keystone/server/wsgi.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/keystone-moon/keystone/server/wsgi.py b/keystone-moon/keystone/server/wsgi.py index dbdad326..ae24c48e 100644 --- a/keystone-moon/keystone/server/wsgi.py +++ b/keystone-moon/keystone/server/wsgi.py @@ -16,6 +16,7 @@ import logging from oslo_config import cfg import oslo_i18n +import oslo_middleware.cors as cors # NOTE(dstanek): i18n.enable_lazy() must be called before @@ -27,12 +28,24 @@ oslo_i18n.enable_lazy() from keystone.common import environment from keystone import config +import keystone.middleware.core as middleware_core from keystone.server import common from keystone import service as keystone_service CONF = cfg.CONF +KEYSTONE_HEADERS = [ + middleware_core.AUTH_TOKEN_HEADER, + middleware_core.SUBJECT_TOKEN_HEADER, + 'X-Project-Id', + 'X-Project-Name', + 'X-Project-Domain-Id', + 'X-Project-Domain-Name', + 'X-Domain-Id', + 'X-Domain-Name' +] + def initialize_application(name): common.configure() @@ -49,6 +62,15 @@ def initialize_application(name): _unused, application = common.setup_backends( startup_application_fn=loadapp) + + # Create a CORS wrapper, and attach keystone-specific defaults that must be + # included in all CORS responses + application = cors.CORS(application, CONF) + application.set_latent( + allow_headers=KEYSTONE_HEADERS, + allow_methods=['GET', 'PUT', 'POST', 'DELETE', 'PATCH'], + expose_headers=KEYSTONE_HEADERS + ) return application |