Skip to content
Snippets Groups Projects
Commit 78c70337 authored by Yordan Kinkov's avatar Yordan Kinkov
Browse files

Update GetloginProofResult function according to changes in OCM client

parent 9d711eba
No related branches found
No related tags found
1 merge request!36Update GetloginProofResult function according to changes in OCM client
Pipeline #52910 passed
...@@ -74,8 +74,15 @@ func (of *OcmFuncs) GetLoginProofResult() (*rego.Function, rego.Builtin1) { ...@@ -74,8 +74,15 @@ func (of *OcmFuncs) GetLoginProofResult() (*rego.Function, rego.Builtin1) {
return nil, err return nil, err
} }
claims := map[string]interface{}{}
for _, cred := range res.Data.Data {
for cName, cValue := range cred.Claims {
claims[cName] = cValue
}
}
var val ast.Value var val ast.Value
val, err = ast.InterfaceToValue(res.Data.Claims) val, err = ast.InterfaceToValue(claims)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -70,12 +70,20 @@ func TestGetLoginProofResult(t *testing.T) { ...@@ -70,12 +70,20 @@ func TestGetLoginProofResult(t *testing.T) {
expected := `{"family_name":"Doe","name":"John"}` expected := `{"family_name":"Doe","name":"John"}`
ocmResponse := `{ ocmResponse := `{
"statusCode": 200, "statusCode": 200,
"message": "Proof presentation fetch successfully",
"data": { "data": {
"credentialSubject": { "state": "done",
"name":"John", "data": [
"family_name":"Doe" {
} "credentialSubject": {
"family_name":"Doe"
}
},
{
"credentialSubject": {
"name":"John"
}
}
]
} }
}` }`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment