Browse Source

Merge pull request #119 from domste/entitlement-api-deprecation-exception

Entitlement API deprecation exception
pull/150/head
Marcos Pereira 4 years ago
committed by GitHub
parent
commit
91e85ecb25
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      keycloak/exceptions.py
  2. 6
      keycloak/keycloak_openid.py

3
keycloak/exceptions.py

@ -53,6 +53,9 @@ class KeycloakOperationError(KeycloakError):
pass
class KeycloakDeprecationError(KeycloakError):
pass
class KeycloakGetError(KeycloakOperationError):
pass

6
keycloak/keycloak_openid.py

@ -28,7 +28,8 @@ from jose import jwt
from .authorization import Authorization
from .connection import ConnectionManager
from .exceptions import raise_error_from_response, KeycloakGetError, \
KeycloakRPTNotFound, KeycloakAuthorizationConfigError, KeycloakInvalidTokenError
KeycloakRPTNotFound, KeycloakAuthorizationConfigError, KeycloakInvalidTokenError,
KeycloakDeprecationError
from .urls_patterns import (
URL_REALM,
URL_AUTH,
@ -292,6 +293,9 @@ class KeycloakOpenID:
params_path = {"realm-name": self.realm_name, "resource-server-id": resource_server_id}
data_raw = self.connection.raw_get(URL_ENTITLEMENT.format(**params_path))
if data_raw.status_code == 404:
return raise_error_from_response(data_raw, KeycloakDeprecationError)
return raise_error_from_response(data_raw, KeycloakGetError)
def introspect(self, token, rpt=None, token_type_hint=None):

Loading…
Cancel
Save