Skip to content

Commit

Permalink
Return 403 instead of 401 when policies reject
Browse files Browse the repository at this point in the history
Fixes bug 921744

Change-Id: Ib4b6405dffa3ee2e8ef2b8a7710124f97f0fdf43
  • Loading branch information
bcwaldon committed Jan 25, 2012
1 parent fcf73f9 commit 4a04d29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nova/api/openstack/wsgi.py
Expand Up @@ -573,7 +573,7 @@ def __exit__(self, ex_type, ex_value, ex_traceback):

if isinstance(ex_value, exception.NotAuthorized):
msg = unicode(ex_value)
raise Fault(webob.exc.HTTPUnauthorized(explanation=msg))
raise Fault(webob.exc.HTTPForbidden(explanation=msg))
elif isinstance(ex_value, TypeError):
LOG.exception(ex_value)
raise Fault(webob.exc.HTTPBadRequest())
Expand Down
2 changes: 1 addition & 1 deletion nova/tests/api/openstack/test_wsgi.py
Expand Up @@ -204,7 +204,7 @@ def index(self, req):
req = webob.Request.blank('/tests')
app = fakes.TestRouter(Controller())
response = req.get_response(app)
self.assertEqual(response.status_int, 401)
self.assertEqual(response.status_int, 403)

def test_dispatch(self):
class Controller(object):
Expand Down

0 comments on commit 4a04d29

Please sign in to comment.