JanssenProject / JanssenProject/jans

feat(jans-auth-server): introduce sophisticated JSON merge for authorization_details (or let it implement in custom script)

Open
#7,112 0 comments 0 reactions 1 assignee Claimed by @yuriyz View on GitHub
comp-jans-auth-server kind-enhancement kind-feature
Dominant language
Java
Stars
648
Forks
174
Avg merge
1d 18h
Merged PRs (30d)
110

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.