jans
jans copied to clipboard
feat(jans-auth-server): introduce sophisticated JSON merge for authorization_details (or let it implement in custom script)
Description
feat(jans-auth-server): introduce sophisticated JSON merge for authorization_details
When we have authorization_details1
persisted in client authorization and then we got another authorization request with different authorization_details2
. Right now AS simply adds together both arrays.
For example: authorization_details1
[{
"type": "account_information",
"actions": [
"list_accounts",
"read_balances",
"read_transactions"
],
"locations": [
"https://example.com/accounts"
]
}
]
authorization_details2
[{
"type": "payment_initiation",
"actions": [
"initiate",
"status",
"cancel"
],
"locations": [
"https://example.com/payments"
],
"instructedAmount": {
"currency": "EUR",
"amount": "123.50"
},
"creditorName": "Merchant A",
"creditorAccount": {
"iban": "DE02100100109307118603"
},
"remittanceInformationUnstructured": "Ref Number Merchant"
}
]
Results in authorization_details:
[
{
"type": "account_information",
"actions": [
"list_accounts",
"read_balances",
"read_transactions"
],
"locations": [
"https://example.com/accounts"
]
},
{
"type": "payment_initiation",
"actions": [
"initiate",
"status",
"cancel"
],
"locations": [
"https://example.com/payments"
],
"instructedAmount": {
"currency": "EUR",
"amount": "123.50"
},
"creditorName": "Merchant A",
"creditorAccount": {
"iban": "DE02100100109307118603"
},
"remittanceInformationUnstructured": "Ref Number Merchant"
}
]
This perfectly works if authorization_detail type is different but in more complicated case when it's the same it is not going to work. We need more sophisticated JSON merge for same types or maybe even better introduce new AuthzDetailArray
custom script and allow implement merge logic in custom script.
Test cases and code coverage
- [ ] Write unit test to cover added/changed code
- [ ] Update integration tests to cover added/changed code
- [ ] Update docs