Search in sources :

Example 21 with ClientPoliciesRepresentation

use of org.keycloak.representations.idm.ClientPoliciesRepresentation in project keycloak by keycloak.

the class DefaultClientPolicyManager method updateClientPolicies.

@Override
public void updateClientPolicies(RealmModel realm, ClientPoliciesRepresentation clientPolicies) throws ClientPolicyException {
    String validatedJsonString = null;
    try {
        if (clientPolicies == null) {
            throw new ClientPolicyException("Passing null clientPolicies not allowed");
        }
        ClientPoliciesRepresentation clientPoliciesRep = ClientPoliciesUtil.getValidatedClientPoliciesForUpdate(session, realm, clientPolicies, globalClientProfilesSupplier.get());
        validatedJsonString = ClientPoliciesUtil.convertClientPoliciesRepresentationToJson(clientPoliciesRep);
    } catch (ClientPolicyException e) {
        logger.warnv("VALIDATE SERIALIZE POLICIES FAILED :: error = {0}, error detail = {1}", e.getError(), e.getErrorDetail());
        throw e;
    }
    ClientPoliciesUtil.setClientPoliciesJsonString(realm, validatedJsonString);
    logger.tracev("UPDATE POLICIES :: realm = {0}, validated and modified PUT = {1}", realm.getName(), validatedJsonString);
}
Also used : ClientPoliciesRepresentation(org.keycloak.representations.idm.ClientPoliciesRepresentation)

Aggregations

ClientPoliciesRepresentation (org.keycloak.representations.idm.ClientPoliciesRepresentation)21 ClientPolicyRepresentation (org.keycloak.representations.idm.ClientPolicyRepresentation)9 ClientProfilesRepresentation (org.keycloak.representations.idm.ClientProfilesRepresentation)9 Test (org.junit.Test)6 ClientProfileRepresentation (org.keycloak.representations.idm.ClientProfileRepresentation)4 ClientPolicyConditionRepresentation (org.keycloak.representations.idm.ClientPolicyConditionRepresentation)3 ClientPoliciesBuilder (org.keycloak.testsuite.util.ClientPoliciesUtil.ClientPoliciesBuilder)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 ClientPolicyConditionConfigurationRepresentation (org.keycloak.representations.idm.ClientPolicyConditionConfigurationRepresentation)2 ClientPolicyException (org.keycloak.services.clientpolicy.ClientPolicyException)2 ClientPolicyConditionProvider (org.keycloak.services.clientpolicy.condition.ClientPolicyConditionProvider)2 ClientPolicyBuilder (org.keycloak.testsuite.util.ClientPoliciesUtil.ClientPolicyBuilder)2 ClientProfilesBuilder (org.keycloak.testsuite.util.ClientPoliciesUtil.ClientProfilesBuilder)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Collections (java.util.Collections)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Set (java.util.Set)1