Skip to content

Commit

Permalink
Merge "Return 403 instead of 401 when policies reject" into milestone…
Browse files Browse the repository at this point in the history
…-proposed
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 26, 2012
2 parents 32a6f49 + 6fdd1f6 commit facd895
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nova/api/openstack/wsgi.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_verify_show_cant_view_other_tenant(self):
try:
res = req.get_response(fakes.wsgi_app(
fake_auth_context=self.alt_user_context))
self.assertEqual(res.status_int, 401)
self.assertEqual(res.status_int, 403)
finally:
policy.reset()

Expand Down
2 changes: 1 addition & 1 deletion nova/tests/api/openstack/test_wsgi.py
Original file line number Diff line number Diff line change
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 facd895

Please sign in to comment.