mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-06-14 22:17:34 +08:00
Check that our required OIDC scopes are present.
This commit is contained in:
@@ -102,6 +102,17 @@ def get_user(request):
|
|||||||
if not "active" in data or not data["active"]:
|
if not "active" in data or not data["active"]:
|
||||||
raise Unauthorized("OIDC token invalid or expired.")
|
raise Unauthorized("OIDC token invalid or expired.")
|
||||||
|
|
||||||
|
presented_scopes = data['scope']
|
||||||
|
required_scopes = [
|
||||||
|
'openid',
|
||||||
|
'https://id.fedoraproject.org/scope/groups',
|
||||||
|
'https://mbs.fedoraproject.org/oidc/submit-build',
|
||||||
|
]
|
||||||
|
for scope in required_scopes:
|
||||||
|
if scope not in presented_scopes:
|
||||||
|
raise Unauthorized("Required OIDC scope %r not present: %r" % (
|
||||||
|
scope, presented_scopes))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
extended_data = _get_user_info(token)
|
extended_data = _get_user_info(token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user