Skip to content

Commit

Permalink
Define property to set Component Allow Origin
Browse files Browse the repository at this point in the history
  • Loading branch information
gcatanese committed Oct 9, 2024
1 parent bcc8c47 commit 7471148
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ ADYEN_SESSION_AUTHENTICATION_API_URL=https://test.adyen.com/authe/api/v1/session
## When undefined the default theme will be used
ADYEN_HOSTED_ONBOARDING_THEME_ID=

## URL where the AfP components will appear
## Examples: https://www.example.com | https://*.example.com | http://localhost
##
ADYEN_COMPONENTS_ALLOW_ORIGIN=

11 changes: 11 additions & 0 deletions src/main/java/com/adyen/config/ApplicationProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class ApplicationProperty {
@Value("${ADYEN_SESSION_AUTHENTICATION_API_URL:https://test.adyen.com/authe/api/v1/sessions}")
private String sessionAuthenticationApiUrl;

@Value("${ADYEN_COMPONENTS_ALLOW_ORIGIN}")
private String componentsAllowOrigin;

public String getApiKey() {
return apiKey;
}
Expand Down Expand Up @@ -82,4 +85,12 @@ public String getSessionAuthenticationApiUrl() {
public void setSessionAuthenticationApiUrl(String sessionAuthenticationApiUrl) {
this.sessionAuthenticationApiUrl = sessionAuthenticationApiUrl;
}

public String getComponentsAllowOrigin() {
return componentsAllowOrigin;
}

public void setComponentsAllowOrigin(String componentsAllowOrigin) {
this.componentsAllowOrigin = componentsAllowOrigin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ResponseEntity<SessionResponse> getTransactions() {

// Perform session call to obtain a valid Session token
SessionRequest sessionRequest = new SessionRequest()
.allowOrigin("http://localhost")
.allowOrigin(getApplicationProperty().getComponentsAllowOrigin())
.product("platform")
.policy(new SessionRequestPolicy()
.resources(List.of(new PolicyResource()
Expand Down

0 comments on commit 7471148

Please sign in to comment.