Search in sources :

Example 6 with GetAuthorizationUrlResponse

use of io.jans.ca.common.response.GetAuthorizationUrlResponse in project jans by JanssenProject.

the class StressTest method test.

@Parameters({ "host", "redirectUrl", "opHost" })
@Test(invocationCount = 10, threadPoolSize = 10, enabled = true)
public void test(String host, String redirectUrl, String opHost) {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl);
    final GetAuthorizationUrlParams params = new GetAuthorizationUrlParams();
    params.setRpId(site.getRpId());
    final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(site), null, params);
    assertNotNull(resp);
    notEmpty(resp.getAuthorizationUrl());
    assertTrue(resp.getAuthorizationUrl().contains("acr_values"));
}
Also used : GetAuthorizationUrlResponse(io.jans.ca.common.response.GetAuthorizationUrlResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetAuthorizationUrlParams(io.jans.ca.common.params.GetAuthorizationUrlParams) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) RegisterSiteTest(io.jans.ca.server.RegisterSiteTest)

Example 7 with GetAuthorizationUrlResponse

use of io.jans.ca.common.response.GetAuthorizationUrlResponse in project jans by JanssenProject.

the class GetAuthorizationUrlTest method test.

@Parameters({ "host", "redirectUrls", "opHost" })
@Test
public void test(String host, String redirectUrls, String opHost) {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams();
    commandParams.setRpId(site.getRpId());
    final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(site), null, commandParams);
    assertNotNull(resp);
    notEmpty(resp.getAuthorizationUrl());
}
Also used : GetAuthorizationUrlResponse(io.jans.ca.common.response.GetAuthorizationUrlResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetAuthorizationUrlParams(io.jans.ca.common.params.GetAuthorizationUrlParams) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 8 with GetAuthorizationUrlResponse

use of io.jans.ca.common.response.GetAuthorizationUrlResponse in project jans by JanssenProject.

the class GetAuthorizationUrlTest method testWithResponseType.

@Parameters({ "host", "redirectUrls", "opHost" })
@Test
public void testWithResponseType(String host, String redirectUrls, String opHost) throws IOException {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams();
    commandParams.setRpId(site.getRpId());
    commandParams.setResponseTypes(Lists.newArrayList("code", "token"));
    final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(site), null, commandParams);
    assertNotNull(resp);
    notEmpty(resp.getAuthorizationUrl());
    Map<String, String> parameters = CoreUtils.splitQuery(resp.getAuthorizationUrl());
    assertTrue(parameters.get("response_type").contains("code"));
    assertTrue(parameters.get("response_type").contains("token"));
}
Also used : GetAuthorizationUrlResponse(io.jans.ca.common.response.GetAuthorizationUrlResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetAuthorizationUrlParams(io.jans.ca.common.params.GetAuthorizationUrlParams) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 9 with GetAuthorizationUrlResponse

use of io.jans.ca.common.response.GetAuthorizationUrlResponse in project jans by JanssenProject.

the class GetAuthorizationUrlTest method testWithParams.

@Parameters({ "host", "redirectUrls", "opHost" })
@Test
public void testWithParams(String host, String redirectUrls, String opHost) throws IOException {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
    final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams();
    commandParams.setRpId(site.getRpId());
    Map<String, String> params = new HashMap<>();
    params.put("max_age", "70");
    params.put("is_valid", "true");
    commandParams.setParams(params);
    final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(site), null, commandParams);
    notEmpty(resp.getAuthorizationUrl());
    Map<String, String> parameters = CoreUtils.splitQuery(resp.getAuthorizationUrl());
    assertTrue(StringUtils.isNotBlank(parameters.get("max_age")));
    assertEquals(parameters.get("max_age"), "70");
    assertTrue(StringUtils.isNotBlank(parameters.get("is_valid")));
    assertEquals(parameters.get("is_valid"), "true");
    assertNotNull(resp);
}
Also used : GetAuthorizationUrlResponse(io.jans.ca.common.response.GetAuthorizationUrlResponse) HashMap(java.util.HashMap) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetAuthorizationUrlParams(io.jans.ca.common.params.GetAuthorizationUrlParams) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 10 with GetAuthorizationUrlResponse

use of io.jans.ca.common.response.GetAuthorizationUrlResponse in project jans by JanssenProject.

the class GetAuthorizationUrlTest method testWithNonceParameter.

@Parameters({ "host", "opHost", "redirectUrls", "postLogoutRedirectUrl", "logoutUrl", "paramRedirectUrl" })
@Test
public void testWithNonceParameter(String host, String opHost, String redirectUrls, String postLogoutRedirectUrl, String logoutUrl, String paramRedirectUrl) throws IOException {
    ClientInterface client = Tester.newClient(host);
    final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls, postLogoutRedirectUrl, logoutUrl, false);
    final GetAuthorizationUrlParams commandParams = new GetAuthorizationUrlParams();
    commandParams.setRpId(site.getRpId());
    commandParams.setRedirectUri(paramRedirectUrl);
    commandParams.setNonce("dummy_nonce");
    final GetAuthorizationUrlResponse resp = client.getAuthorizationUrl(Tester.getAuthorization(site), null, commandParams);
    assertNotNull(resp);
    notEmpty(resp.getAuthorizationUrl());
    assertTrue(resp.getAuthorizationUrl().contains(paramRedirectUrl));
    Map<String, String> parameters = CoreUtils.splitQuery(resp.getAuthorizationUrl());
    assertTrue(StringUtils.isNotBlank(parameters.get("nonce")));
    assertEquals(parameters.get("nonce"), "dummy_nonce");
}
Also used : GetAuthorizationUrlResponse(io.jans.ca.common.response.GetAuthorizationUrlResponse) ClientInterface(io.jans.ca.client.ClientInterface) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) GetAuthorizationUrlParams(io.jans.ca.common.params.GetAuthorizationUrlParams) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Aggregations

GetAuthorizationUrlResponse (io.jans.ca.common.response.GetAuthorizationUrlResponse)10 GetAuthorizationUrlParams (io.jans.ca.common.params.GetAuthorizationUrlParams)9 ClientInterface (io.jans.ca.client.ClientInterface)8 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)8 Parameters (org.testng.annotations.Parameters)8 Test (org.testng.annotations.Test)8 HashMap (java.util.HashMap)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 GetRequestObjectUriParams (io.jans.ca.common.params.GetRequestObjectUriParams)1 UpdateSiteParams (io.jans.ca.common.params.UpdateSiteParams)1 GetRequestObjectUriResponse (io.jans.ca.common.response.GetRequestObjectUriResponse)1 HttpException (io.jans.ca.server.HttpException)1 RegisterSiteTest (io.jans.ca.server.RegisterSiteTest)1 Rp (io.jans.ca.server.service.Rp)1