Search in sources :

Example 1 with ClientAttributes

use of org.oxauth.persistence.model.ClientAttributes in project oxAuth by GluuFederation.

the class JsonApplierServerTest method transfer_fromRegisterRequestToClientAttribute_withListOfString_shouldTransferValueCorrectly.

@Test
public void transfer_fromRegisterRequestToClientAttribute_withListOfString_shouldTransferValueCorrectly() {
    RegisterRequest request = new RegisterRequest();
    request.setAdditionalAudience(Lists.newArrayList("aud1", "aud2"));
    ClientAttributes attributes = new ClientAttributes();
    JsonApplier.getInstance().transfer(request, attributes);
    assertEquals(Lists.newArrayList("aud1", "aud2"), attributes.getAdditionalAudience());
}
Also used : RegisterRequest(org.gluu.oxauth.client.RegisterRequest) ClientAttributes(org.oxauth.persistence.model.ClientAttributes) Test(org.testng.annotations.Test)

Example 2 with ClientAttributes

use of org.oxauth.persistence.model.ClientAttributes in project oxAuth by GluuFederation.

the class JsonApplierServerTest method apply_fromClientAttributesToJSONObject_withListOfString_shouldTransferValueCorrectly.

@Test
public void apply_fromClientAttributesToJSONObject_withListOfString_shouldTransferValueCorrectly() {
    ClientAttributes attributes = new ClientAttributes();
    attributes.setAdditionalAudience(Lists.newArrayList("aud1", "aud2"));
    JSONObject jsonObject = new JSONObject();
    JsonApplier.getInstance().apply(attributes, jsonObject);
    assertEquals(new JSONArray(Lists.newArrayList("aud1", "aud2")), jsonObject.getJSONArray("additional_audience"));
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) ClientAttributes(org.oxauth.persistence.model.ClientAttributes) Test(org.testng.annotations.Test)

Example 3 with ClientAttributes

use of org.oxauth.persistence.model.ClientAttributes in project oxTrust by GluuFederation.

the class UpdateClientAction method saveAttributesJson.

private void saveAttributesJson() {
    ClientAttributes clientAttributes = new ClientAttributes();
    try {
        clientAttributes = new ObjectMapper().readValue(this.oxAttributesJson, ClientAttributes.class);
    } catch (Exception e) {
        log.info("error parsing json:" + e);
    }
    clientAttributes.setPostAuthnScripts(postAuthnScripts.stream().map(CustomScript::getDn).collect(Collectors.toList()));
    clientAttributes.setRptClaimsScripts(rptClaimsScripts.stream().map(CustomScript::getDn).collect(Collectors.toList()));
    clientAttributes.setConsentGatheringScripts(consentScripts.stream().map(CustomScript::getDn).collect(Collectors.toList()));
    clientAttributes.setSpontaneousScopeScriptDns(spontaneousScopesScripts.stream().map(CustomScript::getDn).collect(Collectors.toList()));
    clientAttributes.setIntrospectionScripts(introspectionScripts.stream().map(CustomScript::getDn).collect(Collectors.toList()));
    this.client.setAttributes(clientAttributes);
}
Also used : CustomScript(org.gluu.model.custom.script.model.CustomScript) ClientAttributes(org.oxauth.persistence.model.ClientAttributes) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException)

Aggregations

ClientAttributes (org.oxauth.persistence.model.ClientAttributes)3 Test (org.testng.annotations.Test)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 JSONException (org.codehaus.jettison.json.JSONException)1 CustomScript (org.gluu.model.custom.script.model.CustomScript)1 RegisterRequest (org.gluu.oxauth.client.RegisterRequest)1 BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)1 EncryptionException (org.gluu.util.security.StringEncrypter.EncryptionException)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1