Search in sources :

Example 1 with UpdateSiteResponse

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

the class UpdateSiteTest method update.

@Parameters({ "host", "opHost" })
@Test
public void update(String host, String opHost) throws IOException {
    String authorizationRedirectUri = "https://client.example.com/cb";
    String anotherRedirectUri = "https://client.example.com/another";
    String logoutUri = "https://client.example.com/logout";
    final RegisterSiteParams registerParams = new RegisterSiteParams();
    registerParams.setOpHost(opHost);
    registerParams.setClientFrontchannelLogoutUri(logoutUri);
    registerParams.setRedirectUris(Lists.newArrayList(authorizationRedirectUri, anotherRedirectUri, logoutUri));
    registerParams.setAcrValues(Lists.newArrayList("basic"));
    registerParams.setScope(Lists.newArrayList("openid", "profile"));
    registerParams.setGrantTypes(Lists.newArrayList("authorization_code"));
    registerParams.setResponseTypes(Lists.newArrayList("code"));
    registerParams.setAcrValues(Lists.newArrayList("acrBefore"));
    RegisterSiteResponse registerResponse = Tester.newClient(host).registerSite(registerParams);
    assertNotNull(registerResponse);
    assertNotNull(registerResponse.getRpId());
    String rpId = registerResponse.getRpId();
    Rp fetchedRp = fetchRp(host, registerResponse);
    assertEquals(authorizationRedirectUri, fetchedRp.getRedirectUri());
    assertEquals(Lists.newArrayList("acrBefore"), fetchedRp.getAcrValues());
    final UpdateSiteParams updateParams = new UpdateSiteParams();
    updateParams.setRpId(rpId);
    updateParams.setRedirectUris(Lists.newArrayList(anotherRedirectUri));
    updateParams.setScope(Lists.newArrayList("profile"));
    updateParams.setAcrValues(Lists.newArrayList("acrAfter"));
    UpdateSiteResponse updateResponse = Tester.newClient(host).updateSite(Tester.getAuthorization(registerResponse), null, updateParams);
    assertNotNull(updateResponse);
    fetchedRp = fetchRp(host, registerResponse);
    assertEquals(anotherRedirectUri, fetchedRp.getRedirectUri());
    assertEquals(Lists.newArrayList("acrAfter"), fetchedRp.getAcrValues());
}
Also used : RegisterSiteParams(io.jans.ca.common.params.RegisterSiteParams) UpdateSiteParams(io.jans.ca.common.params.UpdateSiteParams) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse) Rp(io.jans.ca.server.service.Rp) UpdateSiteResponse(io.jans.ca.common.response.UpdateSiteResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 2 with UpdateSiteResponse

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

the class RegisterSiteTest method update.

@Parameters({ "host" })
@Test(dependsOnMethods = { "register" })
public void update(String host) {
    TestUtils.notEmpty(site.getRpId());
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DAY_OF_YEAR, 1);
    // more specific site registration
    final UpdateSiteParams params = new UpdateSiteParams();
    params.setRpId(site.getRpId());
    params.setScope(Lists.newArrayList("profile"));
    params.setClientName("rp-client-updated-test");
    params.setClientTokenEndpointAuthMethod("client_secret_basic");
    params.setClientTokenEndpointAuthSigningAlg("HS256");
    params.setClaimsRedirectUri(Lists.newArrayList("https://client.example.org/update"));
    params.setAccessTokenSigningAlg("RS256");
    params.setAccessTokenAsJwt(false);
    params.setRptAsJwt(true);
    params.setFrontChannelLogoutSessionRequired(false);
    params.setRequireAuthTime(false);
    params.setRunIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims(true);
    params.setLogoUri("https://client.example.org/authorization//update1");
    params.setClientUri("https://client.example.org/authorization/update2");
    params.setPolicyUri("https://client.example.org/authorization/update3");
    params.setTosUri("https://client.example.org/authorization/update4");
    params.setJwks("{\"key1\": \"value1\", \"key2\": \"value2\"}");
    params.setIdTokenBindingCnf("4NRB1-0XZABZI9E6-5SM3R");
    params.setTlsClientAuthSubjectDn("www.test.com");
    params.setSubjectType("pairwise");
    params.setIdTokenSignedResponseAlg("PS256");
    params.setIdTokenEncryptedResponseAlg("A128KW");
    params.setIdTokenEncryptedResponseEnc("A128CBC+HS256");
    params.setUserInfoSignedResponseAlg("HS256");
    params.setUserInfoEncryptedResponseAlg("RSA1_5");
    params.setUserInfoEncryptedResponseEnc("A128CBC+HS256");
    params.setRequestObjectSigningAlg("HS256");
    params.setRequestObjectEncryptionAlg("RSA1_5");
    params.setRequestObjectEncryptionEnc("A128CBC+HS256");
    params.setDefaultMaxAge(200000000);
    params.setInitiateLoginUri("https://client.example.org/authorization/page2");
    params.setAuthorizedOrigins(Lists.newArrayList("beem://www.test-updated.com", "fb://updated.local.url"));
    params.setAccessTokenLifetime(200000000);
    params.setSoftwareId("4NRB1-0XZABZI9E6-5SM3R");
    params.setSoftwareVersion("3.0");
    Map<String, String> customAttributes = new HashMap<>();
    customAttributes.put("key1", "v1");
    customAttributes.put("key2", "v2");
    params.setCustomAttributes(customAttributes);
    UpdateSiteResponse resp = Tester.newClient(host).updateSite(Tester.getAuthorization(site), null, params);
    assertNotNull(resp);
}
Also used : UpdateSiteParams(io.jans.ca.common.params.UpdateSiteParams) UpdateSiteResponse(io.jans.ca.common.response.UpdateSiteResponse) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 3 with UpdateSiteResponse

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

the class UpdateSiteOperation method execute.

@Override
public IOpResponse execute(UpdateSiteParams params) {
    rp = getRp();
    LOG.info("Updating rp ... rp: " + rp);
    persistRp(rp, params);
    UpdateSiteResponse response = new UpdateSiteResponse();
    response.setRpId(rp.getRpId());
    return response;
}
Also used : UpdateSiteResponse(io.jans.ca.common.response.UpdateSiteResponse)

Aggregations

UpdateSiteResponse (io.jans.ca.common.response.UpdateSiteResponse)3 UpdateSiteParams (io.jans.ca.common.params.UpdateSiteParams)2 Parameters (org.testng.annotations.Parameters)2 Test (org.testng.annotations.Test)2 RegisterSiteParams (io.jans.ca.common.params.RegisterSiteParams)1 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)1 Rp (io.jans.ca.server.service.Rp)1