Skip to content

Commit

Permalink
#3486 can't catch an error we can't import
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Apr 30, 2022
1 parent 0e4dc0a commit 28e9c03
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions xpra/server/auth/keycloak_auth.py
Expand Up @@ -105,9 +105,16 @@ def check(self, response_json) -> bool:
return False

try:
# pylint: disable=import-outside-toplevel
from keycloak import KeycloakOpenID
from keycloak.exceptions import KeycloakError
except ImportError as e:
log("check(..)", exc_info=True)
log.warn("Warning: cannot use keycloak authentication:")
log.warn(" %s", e)
return False

try:
# Configure client
keycloak_openid = KeycloakOpenID(server_url=self.server_url,
client_id=self.client_id,
Expand Down Expand Up @@ -153,11 +160,6 @@ def check(self, response_json) -> bool:
log.error("Error: keycloak authentication failed")
log.error(" error code %s: %s", e.response_code, e.error_message)
return False
except ImportError as e:
log("check(..)", exc_info=True)
log.warn("Warning: cannot use keycloak authentication:")
log.warn(" %s", e)
return False


def main(args): # pragma: no cover
Expand Down

0 comments on commit 28e9c03

Please sign in to comment.