Skip to content

Commit 66ee608

Browse files
authored
Merge pull request #59 from ctriant/fix_scopes_handler
Fix scopes_handler after fedservice refactor
2 parents 060c4f2 + b9fb7ba commit 66ee608

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/idpyoidc/server/authz/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ def __call__(
8888
if not scopes:
8989
scopes = request.get("scope", [])
9090
else:
91-
_allowed = _context.cdb[_client_id].get('allowed_scopes', [])
92-
if _allowed:
93-
scopes = list(set(scopes).intersection(set(_allowed)))
91+
scopes = _context.scopes_handler.filter_scopes(scopes, client_id=_client_id)
9492
grant.scope = scopes
9593

9694
# After this is where user consent should be handled

src/idpyoidc/server/claims/oauth2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Claims(claims.Claims):
1919

2020
_supports = {
2121
"deny_unknown_scopes": False,
22+
"scopes_handler": None,
2223
"response_types_supported": ["code"],
2324
"response_modes_supported": ["code"],
2425
"jwks_uri": None,

src/idpyoidc/server/claims/oidc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Claims(server_claims.Claims):
4343
"contacts": None,
4444
"default_max_age": 86400,
4545
"deny_unknown_scopes": False,
46+
"scopes_handler": None,
4647
"display_values_supported": None,
4748
"encrypt_id_token_supported": None,
4849
# "grant_types_supported": ["authorization_code", "implicit", "refresh_token"],

src/idpyoidc/server/configure.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ class EntityConfiguration(Base):
156156
"template_dir": None,
157157
"token_handler_args": {},
158158
"userinfo": None,
159+
"scopes_handler": None
159160
}
160161

161162
def __init__(
@@ -348,6 +349,9 @@ def __init__(
348349
"refresh_token",
349350
],
350351
},
352+
"scopes_handler": {
353+
"class": "idpyoidc.server.scopes.Scopes"
354+
},
351355
"claims_interface": {"class": "idpyoidc.server.session.claims.ClaimsInterface", "kwargs": {}},
352356
"cookie_handler": {
353357
"class": "idpyoidc.server.cookie_handler.CookieHandler",

0 commit comments

Comments
 (0)