Search in sources :

Example 16 with ClientInterface

use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.

the class GetJwksTest method test_withOpConfigurationEndpoint.

@Test
@Parameters({ "host", "opConfigurationEndpoint" })
public void test_withOpConfigurationEndpoint(String host, String opConfigurationEndpoint) {
    final ClientInterface client = Tester.newClient(host);
    final GetJwksParams params = new GetJwksParams();
    params.setOpConfigurationEndpoint(opConfigurationEndpoint);
    final GetJwksResponse response = client.getJwks(Tester.getAuthorization(), null, params);
    assertNotNull(response);
    assertNotNull(response.getKeys());
    assertFalse(response.getKeys().isEmpty());
}
Also used : GetJwksParams(io.jans.ca.common.params.GetJwksParams) GetJwksResponse(io.jans.ca.common.response.GetJwksResponse) ClientInterface(io.jans.ca.client.ClientInterface) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 17 with ClientInterface

use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.

the class GetRequestUriTest method test.

@Parameters({ "host", "redirectUrls", "opHost" })
@Test
public void test(String host, String redirectUrls, String opHost) {
    ClientInterface client = Tester.newClient(host);
    // client registration
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    // jwks generation
    JsonNode jwks = client.getRpJwks();
    // update jwks in OP
    UpdateSiteParams updateSiteParams = new UpdateSiteParams();
    updateSiteParams.setRpId(site.getRpId());
    updateSiteParams.setJwks(jwks.asText());
    updateSiteParams.setRequestObjectSigningAlg("RS256");
    client.updateSite(Tester.getAuthorization(site), null, updateSiteParams);
    // Request uri
    GetRequestObjectUriParams getRequestUriParams = new GetRequestObjectUriParams();
    getRequestUriParams.setRpId(site.getRpId());
    getRequestUriParams.setRpHostUrl("http://localhost" + ":" + SetUpTest.SUPPORT.getLocalPort());
    GetRequestObjectUriResponse getRequestUriResponse = client.getRequestObjectUri(Tester.getAuthorization(site), null, getRequestUriParams);
    assertNotNull(getRequestUriResponse.getRequestUri());
    // Get Request object
    String requestObjectId = getRequestUriResponse.getRequestUri().substring(getRequestUriResponse.getRequestUri().lastIndexOf('/') + 1);
    String requestObject = client.getRequestObject(requestObjectId);
    assertNotNull(requestObject);
    Map<String, String> paramsMap = new HashMap<>();
    paramsMap.put("request", requestObject);
    final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams();
    commandParams.setRpId(site.getRpId());
    commandParams.setParams(paramsMap);
    final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(site), null, commandParams);
    assertNotNull(resp);
    TestUtils.notEmpty(resp.getAuthorizationUrl());
}
Also used : GetAuthorizationUrlResponse(io.jans.ca.common.response.GetAuthorizationUrlResponse) HashMap(java.util.HashMap) JsonNode(com.fasterxml.jackson.databind.JsonNode) ClientInterface(io.jans.ca.client.ClientInterface) UpdateSiteParams(io.jans.ca.common.params.UpdateSiteParams) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetRequestObjectUriResponse(io.jans.ca.common.response.GetRequestObjectUriResponse) GetRequestObjectUriParams(io.jans.ca.common.params.GetRequestObjectUriParams) GetAuthorizationUrlParams(io.jans.ca.common.params.GetAuthorizationUrlParams) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 18 with ClientInterface

use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.

the class GetTokensByCodeTest method getToken_withRS512.

@Parameters({ "host", "opHost", "redirectUrls", "userId", "userSecret" })
@Test
public void getToken_withRS512(String host, String opHost, String redirectUrls, String userId, String userSecret) {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls, "RS512");
    GetTokensByCodeResponse2 tokensResponse = tokenByCode(client, site, opHost, userId, userSecret, site.getClientId(), redirectUrls, CoreUtils.secureRandomString(), CoreUtils.secureRandomString());
}
Also used : 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)

Example 19 with ClientInterface

use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.

the class GetTokensByCodeTest method getToken_withES256.

@Parameters({ "host", "opHost", "redirectUrls", "userId", "userSecret" })
@Test
public void getToken_withES256(String host, String opHost, String redirectUrls, String userId, String userSecret) {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls, "ES256");
    GetTokensByCodeResponse2 tokensResponse = tokenByCode(client, site, opHost, userId, userSecret, site.getClientId(), redirectUrls, CoreUtils.secureRandomString(), CoreUtils.secureRandomString());
}
Also used : 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)

Example 20 with ClientInterface

use of io.jans.ca.client.ClientInterface in project jans by JanssenProject.

the class GetTokensByCodeTest method getToken_withHS512.

@Parameters({ "host", "opHost", "redirectUrls", "userId", "userSecret" })
@Test
public void getToken_withHS512(String host, String opHost, String redirectUrls, String userId, String userSecret) {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls, "HS512");
    GetTokensByCodeResponse2 tokensResponse = tokenByCode(client, site, opHost, userId, userSecret, site.getClientId(), redirectUrls, CoreUtils.secureRandomString(), CoreUtils.secureRandomString());
}
Also used : 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)67 Parameters (org.testng.annotations.Parameters)64 Test (org.testng.annotations.Test)64 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)58 GetTokensByCodeResponse2 (io.jans.ca.client.GetTokensByCodeResponse2)21 GetAuthorizationUrlParams (io.jans.ca.common.params.GetAuthorizationUrlParams)8 GetAuthorizationUrlResponse (io.jans.ca.common.response.GetAuthorizationUrlResponse)8 RpGetRptResponse (io.jans.ca.common.response.RpGetRptResponse)7 RsCheckAccessResponse (io.jans.ca.common.response.RsCheckAccessResponse)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 RpGetRptParams (io.jans.ca.common.params.RpGetRptParams)4 RsProtectParams2 (io.jans.ca.client.RsProtectParams2)3 GetIssuerParams (io.jans.ca.common.params.GetIssuerParams)3 RpGetClaimsGatheringUrlParams (io.jans.ca.common.params.RpGetClaimsGatheringUrlParams)3 GetIssuerResponse (io.jans.ca.common.response.GetIssuerResponse)3 RpGetClaimsGatheringUrlResponse (io.jans.ca.common.response.RpGetClaimsGatheringUrlResponse)3 BadRequestException (javax.ws.rs.BadRequestException)3 CorrectRptIntrospectionResponse (io.jans.ca.common.introspection.CorrectRptIntrospectionResponse)2 GetDiscoveryParams (io.jans.ca.common.params.GetDiscoveryParams)2 GetJwksParams (io.jans.ca.common.params.GetJwksParams)2