fix check credentials in loop

This commit is contained in:
Cayo Puigdefabregas 2023-12-14 12:48:46 +01:00
parent 69d1873da4
commit fcc4b34424

View file

@ -258,6 +258,7 @@ class AllowCodeOidc4vpView(GenericMixin):
'Content-Type': 'application/json',
'Authorization': f'Bearer {WALLET_INX_EBSI_PLUGIN_TOKEN}'
}
for v in vcredential:
data = json.dumps({
"type": "VerificationRequest",
"jwtCredential": vcredential[0]
@ -267,15 +268,22 @@ class AllowCodeOidc4vpView(GenericMixin):
headers=headers,
data=data
)
if result.status_code != 200:
return
vps = json.loads(result.text)
try:
roles = vps['credential']['credentialSubject'].get('role')
except Exception:
roles = None
if roles:
break
if not vps.get('verified'):
return
return vps['credential']['credentialSubject'].get('role')
return roles
def get_response_uri(selfi, roles):
code = Code2Roles(roles=roles)