use of net.petafuel.styx.core.xs2a.standards.ing.v1_0.services.AccessTokenService in project tesb-rt-se by Talend.
the class OAuthManagerApplication method getSingletons.
@Override
public Set<Object> getSingletons() {
Set<Object> classes = new HashSet<Object>();
ThirdPartyRegistrationService thirdPartyService = new ThirdPartyRegistrationService();
thirdPartyService.setDataProvider(manager);
AccessTokenService ats = new AccessTokenService();
ats.setDataProvider(manager);
classes.add(thirdPartyService);
classes.add(ats);
return classes;
}
use of net.petafuel.styx.core.xs2a.standards.ing.v1_0.services.AccessTokenService in project styx by petafuel.
the class STYX09 method generateINGAccessToken.
public void generateINGAccessToken(String url) {
AccessTokenService service = new AccessTokenService();
AccessTokenRequest request = new AccessTokenRequest();
try {
AccessToken retrievedAccessToken = service.tokenRequest(url + "/oauth2/token", request);
// give a tolerance of 30 seconds to the expiry date in case of any software
// related delays
this.accessTokenValidUntil = Instant.now().plusSeconds((retrievedAccessToken.getExpiresIn() - 30));
this.accessToken = retrievedAccessToken;
} catch (BankRequestFailedException e) {
LOG.error("Error getting ing access token:", e);
ResponseEntity responseEntity = new ResponseEntity("Generating ING access token failed", ResponseConstant.INTERNAL_SERVER_ERROR, ResponseCategory.ERROR, ResponseOrigin.STYX);
throw new StyxException(responseEntity);
}
}
Aggregations