use of net.petafuel.styx.core.banklookup.sad.entities.Url in project styx by petafuel.
the class STYX09IntegrationTest method configure.
@Override
protected Application configure() {
styx09Option = new ImplementerOption();
styx09Option.setId("STYX09");
ing = new Aspsp();
ing.setConfig(new Config());
ing.setBic(TEST_BIC);
Url url = new Url();
url.setCommonUrl("https://api.sandbox.ing.com");
ing.setSandboxUrl(url);
ResourceConfig config = setupFiltersAndErrorHandlers();
if (pisAccessToken == null || Objects.equals(pisAccessToken, "")) {
Assertions.fail("test.token.access.pis not set in test properties");
}
return config.register(AuthenticationResource.class).register(PaymentInitiationResource.class);
}
use of net.petafuel.styx.core.banklookup.sad.entities.Url in project styx by petafuel.
the class PreAuthResource method preAuthenticate.
/**
* Starts an OAuth sessions and returns the preauthId and the link to the authorization page
* Relevant only for ASPSPs which support/require a preauth in order to access their XS2A interface
*
* @return 200 if successful
*/
@RequiresBIC
@CheckAccessToken(allowedServices = { XS2ATokenType.AIS, XS2ATokenType.PIS, XS2ATokenType.AISPIS, XS2ATokenType.PIIS })
@POST
@Path("/preauth")
public Response preAuthenticate(@NotEmpty @NotBlank @HeaderParam("scope") String scope) {
Url url;
if (Boolean.TRUE.equals(WebServer.isSandbox())) {
url = getXS2AStandard().getAspsp().getSandboxUrl();
} else {
url = getXS2AStandard().getAspsp().getProductionUrl();
}
OAuthSession oAuthSession = OAuthService.startPreAuthSession(url, scope);
String state = oAuthSession.getState();
String link = OAuthService.buildLink(state, getXS2AStandard().getAspsp().getBic());
Links links = new Links();
links.setAuthorizationEndpoint(new Links.Href(link, LinkType.AUTHORIZATION_ENDPOINT));
PreAuthResponse response = new PreAuthResponse(oAuthSession.getId().toString(), links);
LOG.info("Successfully started pre-step Authentication within OAuthSession state={}", state);
return Response.status(ResponseConstant.OK).entity(response).build();
}
Aggregations