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"));
}
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());
}
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"));
}
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);
}
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");
}
Aggregations