File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,13 @@ def validate_scope(self, requested_scope: str | None) -> list[str] | None:
9292 if self .scope is None :
9393 # Client registered without scope restrictions — allow any requested scope
9494 return requested_scopes
95- allowed_scopes = self .scope .split (" " )
96- for scope in requested_scopes :
97- if scope not in allowed_scopes :
98- raise InvalidScopeError (f"Client was not registered with scope { scope } " )
95+ requested = set (requested_scopes )
96+ allowed = set (self .scope .split ())
97+ if not requested .issubset (allowed ):
98+ invalid = requested - allowed
99+ raise InvalidScopeError (
100+ f"Client was not registered with scope(s): { ' ' .join (sorted (invalid ))} "
101+ )
99102 return requested_scopes
100103
101104 def validate_redirect_uri (self , redirect_uri : AnyUrl | None ) -> AnyUrl :
You can’t perform that action at this time.
0 commit comments