Skip to content
Snippets Groups Projects
Verified Commit ca100a65 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[OAuth] Filter scopes by application's allowed scopes if available

parent 1473db29
No related branches found
No related tags found
1 merge request!759Resolve "[OAuth] Allow limiting scopes per application"
......@@ -106,6 +106,9 @@ class AppScopes(BaseScopes):
scopes = []
for app in AppConfig.__subclasses__():
scopes += app.get_available_scopes()
# Filter by allowed scopes of requesting application
if application and application.allowed_scopes:
scopes = list(filter(lambda scope: scope in application.alloewd_scopes, scopes))
return scopes
def get_default_scopes(
......@@ -118,4 +121,7 @@ class AppScopes(BaseScopes):
scopes = []
for app in AppConfig.__subclasses__():
scopes += app.get_default_scopes()
# Filter by allowed scopes of requesting application
if application and application.allowed_scopes:
scopes = list(filter(lambda scope: scope in application.alloewd_scopes, scopes))
return scopes
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment