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

Commit ac9d69f

Browse files
committed
chore: Exception when configuration lacks of userinfo definition
1 parent 6e0b9bf commit ac9d69f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/oidcop/session/claims.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from oidcmsg.oidc import OpenIDSchema
66

77
from oidcop.exception import ServiceError
8+
from oidcop.exception import ImproperlyConfigured
89
from oidcop.scopes import convert_scopes2claims
910

1011
logger = logging.getLogger(__name__)
@@ -129,7 +130,12 @@ def get_user_claims(self, user_id: str, claims_restriction: dict) -> dict:
129130
"""
130131
if claims_restriction:
131132
# Get all possible claims
132-
user_info = self.server_get("endpoint_context").userinfo(user_id, client_id=None)
133+
meth = self.server_get("endpoint_context").userinfo
134+
if not meth:
135+
raise ImproperlyConfigured(
136+
"userinfo MUST be defined in the configuration"
137+
)
138+
user_info = meth(user_id, client_id=None)
133139
# Filter out the claims that can be returned
134140
return {
135141
k: user_info.get(k)

0 commit comments

Comments
 (0)