Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit 898761c

Browse files
committed
Switch to use more descriptive exceptions.
1 parent 4cd94c7 commit 898761c

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/oidcendpoint/client_authn.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
from oidcendpoint import JWT_BEARER
1414
from oidcendpoint import sanitize
15+
from oidcendpoint.exception import InvalidClient
1516
from oidcendpoint.exception import MultipleUsage
1617
from oidcendpoint.exception import NotForMe
18+
from oidcendpoint.exception import UnknownClient
1719

1820
logger = logging.getLogger(__name__)
1921

@@ -264,16 +266,16 @@ def verify_client(
264266

265267
if client_id:
266268
if not client_id in endpoint_context.cdb:
267-
raise ValueError("Unknown Client ID")
269+
raise UnknownClient("Unknown Client ID")
268270

269271
_cinfo = endpoint_context.cdb[client_id]
270272
if isinstance(_cinfo, str):
271273
if not _cinfo in endpoint_context.cdb:
272-
raise ValueError("Unknown Client ID")
274+
raise UnknownClient("Unknown Client ID")
273275

274276
if not valid_client_info(_cinfo):
275277
logger.warning("Client registration has timed out")
276-
raise ValueError("Not valid client")
278+
raise InvalidClient("Not valid client")
277279

278280
# store what authn method was used
279281
if auth_info.get("method"):

src/oidcendpoint/exception.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class UnknownClient(OidcEndpointError):
5858
pass
5959

6060

61+
class InvalidClient(OidcEndpointError):
62+
pass
63+
64+
6165
class UnAuthorizedClient(OidcEndpointError):
6266
pass
6367

0 commit comments

Comments
 (0)