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

Commit cdfa5e5

Browse files
committed
Use filter_scopes in check_unknown_scopes_policy
1 parent 47120f8 commit cdfa5e5

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/oidcop/oauth2/authorization.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,12 @@ def check_unknown_scopes_policy(request_info, client_id, endpoint_context):
253253
allowed_scopes = endpoint_context.scopes_handler.get_allowed_scopes(client_id=client_id)
254254

255255
# this prevents that authz would be released for unavailable scopes
256-
for scope in request_info["scope"]:
257-
if scope not in allowed_scopes:
258-
_msg = "{} requested an unauthorized scope ({})"
259-
logger.warning(_msg.format(client_id, scope))
260-
raise UnAuthorizedClientScope()
256+
if set(request_info["scope"]) != set(
257+
endpoint_context.scopes_handler.filter_scopes(request_info["scope"], client_id=client_id)
258+
):
259+
_msg = "{} requested an unauthorized scope ({})"
260+
logger.warning(_msg.format(client_id, scope))
261+
raise UnAuthorizedClientScope()
261262

262263

263264
class Authorization(Endpoint):

0 commit comments

Comments
 (0)