Make keyclock auth support HTTP 400.
Make keyclock_auth to return exception.BadRequest instead of exception.GlareException. Keyclock may return 400 Http status For some cases. In that case glare throws: "code": 500, "error": {"message": "{\"error\":\"invalid_request\", \"error_description\":\"User session not found\"}" This change came to make glare reflect that this is a token issue. Change-Id: I084f05754d25722039039280826dc5dca4d58b95
This commit is contained in:
parent
12ef49c476
commit
151e82cfcc
|
@ -118,11 +118,13 @@ class KeycloakAuthMiddleware(base_middleware.Middleware):
|
|||
LOG.error(msg)
|
||||
raise exception.GlareException(message=msg)
|
||||
|
||||
if resp.status_code == 400:
|
||||
raise exception.BadRequest(message=resp.text)
|
||||
if resp.status_code == 401:
|
||||
raise exception.Unauthorized(message=resp.text)
|
||||
if resp.status_code == 403:
|
||||
raise exception.Forbidden(message=resp.text)
|
||||
elif resp.status_code >= 400:
|
||||
elif resp.status_code > 400:
|
||||
raise exception.GlareException(message=resp.text)
|
||||
|
||||
if self.mcclient:
|
||||
|
|
Loading…
Reference in New Issue