use of io.jans.ca.common.params.GetAuthorizationUrlParams 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.params.GetAuthorizationUrlParams 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.params.GetAuthorizationUrlParams 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.params.GetAuthorizationUrlParams 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