diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-08-17 20:22:30 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-08-17 20:22:30 -0700 |
| commit | 41819d8d048b889f2e7f5e4ee0ff2873bfdef904 (patch) | |
| tree | aed98a84a5c6c198fc6c35a636b820777f98b2cd /nova/api | |
| parent | 90650e5becb541790a8949edebaf0bff0ceb8f5b (diff) | |
| download | nova-41819d8d048b889f2e7f5e4ee0ff2873bfdef904.tar.gz nova-41819d8d048b889f2e7f5e4ee0ff2873bfdef904.tar.xz nova-41819d8d048b889f2e7f5e4ee0ff2873bfdef904.zip | |
fix integration tests
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/auth.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index d42abe1f8..f4a50fc46 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -34,6 +34,23 @@ LOG = logging.getLogger('nova.api.openstack') FLAGS = flags.FLAGS +class NoAuthMiddleware(wsgi.Middleware): + """Return a fake token if one isn't specified.""" + + @webob.dec.wsgify(RequestClass=wsgi.Request) + def __call__(self, req): + if 'X-Auth-Token' in req.headers: + return self.application + logging.debug("Got no auth token, returning fake info.") + res = webob.Response() + res.headers['X-Auth-Token'] = 'fake' + res.headers['X-Server-Management-Url'] = req.url + res.headers['X-Storage-Url'] = '' + res.headers['X-CDN-Management-Url'] = '' + res.content_type = 'text/plain' + res.status = '204' + return res + class AuthMiddleware(wsgi.Middleware): """Authorize the openstack API request or return an HTTP Forbidden.""" |
