Search in sources :

Example 1 with CheckAccessTokenParams

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());
}
Also used : CheckAccessTokenResponse(io.jans.ca.common.response.CheckAccessTokenResponse) CheckAccessTokenParams(io.jans.ca.common.params.CheckAccessTokenParams) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetTokensByCodeResponse2(io.jans.ca.client.GetTokensByCodeResponse2) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Aggregations

ClientInterface (io.jans.ca.client.ClientInterface)1 GetTokensByCodeResponse2 (io.jans.ca.client.GetTokensByCodeResponse2)1 CheckAccessTokenParams (io.jans.ca.common.params.CheckAccessTokenParams)1 CheckAccessTokenResponse (io.jans.ca.common.response.CheckAccessTokenResponse)1 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)1 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1