use of io.jans.ca.common.response.IntrospectAccessTokenResponse in project jans by JanssenProject.
the class IntrospectAccessTokenTest method introspectAccessToken.
@Parameters({ "host", "opHost", "redirectUrls" })
@Test
public void introspectAccessToken(String host, String opHost, String redirectUrls) {
ClientInterface client = Tester.newClient(host);
RegisterSiteResponse setupResponse = SetupClientTest.setupClient(client, opHost, redirectUrls);
final GetClientTokenParams params = new GetClientTokenParams();
params.setOpHost(opHost);
params.setScope(Lists.newArrayList("openid", "jans_client_api"));
params.setClientId(setupResponse.getClientId());
params.setClientSecret(setupResponse.getClientSecret());
GetClientTokenResponse tokenResponse = client.getClientToken(params);
assertNotNull(tokenResponse);
notEmpty(tokenResponse.getAccessToken());
IntrospectAccessTokenParams introspectParams = new IntrospectAccessTokenParams();
introspectParams.setRpId(setupResponse.getRpId());
introspectParams.setAccessToken(tokenResponse.getAccessToken());
IntrospectAccessTokenResponse introspectionResponse = client.introspectAccessToken("Bearer " + tokenResponse.getAccessToken(), null, introspectParams);
assertNotNull(introspectionResponse);
assertTrue(introspectionResponse.isActive());
assertNotNull(introspectionResponse.getIssuedAt());
assertNotNull(introspectionResponse.getExpiresAt());
assertTrue(introspectionResponse.getExpiresAt() >= introspectionResponse.getIssuedAt());
}
Aggregations