Skip to content

Commit

Permalink
#3486 indent error details
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Apr 30, 2022
1 parent 28e9c03 commit 35a1cbf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions xpra/server/auth/keycloak_auth.py
Expand Up @@ -72,20 +72,22 @@ def check(self, response_json) -> bool:
assert self.challenge_sent
if not response_json:
log.error("Error: keycloak authentication failed")
log.error("Invalid response received from authorization endpoint")
log.error(" invalid response received from authorization endpoint")
return False

try:
response = json.loads(response_json)
except json.JSONDecodeError:
log.error("Error: keycloak authentication failed")
log.error("Invalid response received from authorization endpoint")
log.error(" invalid response received from authorization endpoint")
log("failed to parse json: %r", response_json, exc_info=True)
return False
print("json.loads(%s)=%s", response_json, response)

log.enable_debug()
if not isinstance(response, dict):
log.error("Error: keycloak authentication failed")
log.error("Invalid response received from authorization endpoint")
log.error(" invalid response received from authorization endpoint")
log("response is of type %r but dict type is required", type(response), exc_info=True)
log("failed to load response %r", response, exc_info=True)
return False
Expand All @@ -101,7 +103,7 @@ def check(self, response_json) -> bool:

if not auth_code:
log.error("Error: keycloak authentication failed")
log.error("Invalid response received from authorization endpoint")
log.error(" invalid response received from authorization endpoint")
return False

try:
Expand Down Expand Up @@ -179,5 +181,5 @@ def main(args): # pragma: no cover
print("success")
return 0

if __name__ == "__main__":
if __name__ == "__main__": # pragma: no cover
sys.exit(main(sys.argv))

0 comments on commit 35a1cbf

Please sign in to comment.