-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Accelerator 4] Adding consent enforcement and error handling implementation #130
Conversation
...lerators/fs-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml
Outdated
Show resolved
Hide resolved
...financial/services/accelerator/gateway/executor/impl/consent/ConsentEnforcementExecutor.java
Outdated
Show resolved
Hide resolved
@@ -25,7 +25,7 @@ | |||
<RequestRouter>org.wso2.financial.services.accelerator.gateway.executor.core.DefaultRequestRouter</RequestRouter> | |||
{% endif %} | |||
<FinancialServicesGatewayExecutors> | |||
{% for type in financial_services.gateway.openbanking_gateway_executors.type %} | |||
{% for type in financial_services.gateway.gateway_executors.type %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% for type in financial_services.gateway.gateway
_executors.type %}
Do we need gateway twice here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
@@ -203,6 +203,7 @@ | |||
com.fasterxml.jackson.core;version="${jackson.databinding.version}", | |||
org.owasp.encoder;version="${encoder.wso2.version}" | |||
</Import-Package> | |||
<DynamicImport-Package>*</DynamicImport-Package> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline had to add this to solve dependency not identifying issue.
this.status = ResponseStatus.FOUND; | ||
this.payload = createDefaultErrorObject(errorRedirectURI, error.toString(), errorDescription, state); | ||
this.payload = createDefaultErrorObject(errorURI, error.toString(), errorDescription, state); | ||
} | ||
} | ||
|
||
public JSONObject createDefaultErrorObject(URI redirectURI, String errorCode, String errorMessage, String state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public JSONObject createDefaultErrorObject(URI redirectURI, String errorCode, String errorMessage, String state) { | |
public JSONObject createDefaultErrorObject(URI redirectURI, String errorCode, String errorDescription, String state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
username = OAuth2Util.resolveUsernameFromUserId(ConsentExtensionConstants.TENANT_DOMAIN, userID); | ||
} | ||
} catch (UserStoreException e) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a debug log here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
// From date is earlier than To date | ||
return toDate.isAfter(fromDate); | ||
// From date is equal or earlier than To date | ||
return toDate.isEqual(fromDate) || toDate.isAfter(fromDate); | ||
} catch (DateTimeParseException e) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a debug log here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
return; | ||
} | ||
|
||
boolean isValid = (boolean) jsonResponse.get(IS_VALID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getBoolean() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
JSONArray errorList = new JSONArray(); | ||
for (FSExecutorError error : errors) { | ||
JSONObject errorObj = new JSONObject(); | ||
errorObj.put("code", error.getCode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
return errorList; | ||
} | ||
|
||
private boolean isAnyClientErrors(HashSet<String> statusCodes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private boolean isAnyClientErrors(HashSet<String> statusCodes) { | |
private boolean isAnyClientErrors(Set<String> statusCodes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
for (String statusCode : statusCodes) { | ||
if (statusCode.startsWith("4")) { | ||
return true; | ||
} | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
"consentInformation": { | ||
"key": "value" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1e13ec5
Adding consent enforcement implementation
Issue link: required
Doc Issue: Optional, link issue from documentation repository
Applicable Labels: Spec, product, version, type (specify requested labels)
Development Checklist
Testing Checklist