use of io.jans.ca.common.params.CheckAccessTokenParams in project jans by JanssenProject.
the class CheckAccessTokenTest method test.
@Parameters({ "host", "redirectUrls", "userId", "userSecret", "opHost" })
@Test
public void test(String host, String redirectUrls, String userId, String userSecret, String opHost) {
ClientInterface client = Tester.newClient(host);
String nonce = CoreUtils.secureRandomString();
String state = CoreUtils.secureRandomString();
RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
GetTokensByCodeResponse2 response = GetTokensByCodeTest.tokenByCode(client, site, opHost, userId, userSecret, site.getClientId(), redirectUrls, nonce, state);
final CheckAccessTokenParams params = new CheckAccessTokenParams();
params.setAccessToken(response.getAccessToken());
params.setIdToken(response.getIdToken());
params.setRpId(site.getRpId());
final CheckAccessTokenResponse checkR = client.checkAccessToken(Tester.getAuthorization(site), null, params);
assertNotNull(checkR);
assertTrue(checkR.isActive());
assertNotNull(checkR.getExpiresAt());
assertNotNull(checkR.getIssuedAt());
}
Aggregations