diff --git a/core/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java
index b7127581b1..fdb5fa493d 100644
--- a/core/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java
+++ b/core/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java
@@ -17,18 +17,19 @@
package org.keycloak.representations.idm;
+import java.util.ArrayList;
import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.keycloak.util.JsonSerialization;
/**
* Client Policies' (the set of all Client Policy) external representation class
*
* @author Takashi Norimatsu
*/
-@JsonIgnoreProperties(ignoreUnknown = true)
public class ClientPoliciesRepresentation {
- protected List policies;
+ protected List policies = new ArrayList<>();
public List getPolicies() {
return policies;
@@ -38,4 +39,17 @@ public class ClientPoliciesRepresentation {
this.policies = policies;
}
+ @Override
+ public int hashCode() {
+ return JsonSerialization.mapper.convertValue(this, JsonNode.class).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ClientPoliciesRepresentation)) return false;
+ JsonNode jsonNode = JsonSerialization.mapper.convertValue(this, JsonNode.class);
+ JsonNode jsonNodeThat = JsonSerialization.mapper.convertValue(obj, JsonNode.class);
+ return jsonNode.equals(jsonNodeThat);
+ }
+
}
diff --git a/core/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java
new file mode 100644
index 0000000000..c99817728c
--- /dev/null
+++ b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.keycloak.representations.idm;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Just adds some type-safety to the ClientPolicyConditionConfiguration
+ *
+ * @author Takashi Norimatsu
+ */
+public class ClientPolicyConditionConfigurationRepresentation {
+
+ private Map configAsMap = new HashMap<>();
+
+ @JsonProperty("is-negative-logic")
+ private Boolean negativeLogic;
+
+ public Boolean isNegativeLogic() {
+ return negativeLogic;
+ }
+
+ public void setNegativeLogic(Boolean negativeLogic) {
+ this.negativeLogic = negativeLogic;
+ }
+
+ @JsonAnyGetter
+ public Map getConfigAsMap() {
+ return configAsMap;
+ }
+
+ @JsonAnySetter
+ public void setConfigAsMap(String name, Object value) {
+ this.configAsMap.put(name, value);
+ }
+}
diff --git a/core/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java
new file mode 100644
index 0000000000..b6a9c33c20
--- /dev/null
+++ b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.keycloak.representations.idm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Marek Posolda
+ */
+public class ClientPolicyConditionRepresentation {
+
+ @JsonProperty("condition")
+ private String conditionProviderId;
+
+ private ClientPolicyConditionConfigurationRepresentation configuration;
+
+ public ClientPolicyConditionRepresentation() {
+ }
+
+ public ClientPolicyConditionRepresentation(String conditionProviderId, ClientPolicyConditionConfigurationRepresentation configuration) {
+ this.conditionProviderId = conditionProviderId;
+ this.configuration = configuration;
+ }
+
+ public String getConditionProviderId() {
+ return conditionProviderId;
+ }
+
+ public void setConditionProviderId(String conditionProviderId) {
+ this.conditionProviderId = conditionProviderId;
+ }
+
+ public ClientPolicyConditionConfigurationRepresentation getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(ClientPolicyConditionConfigurationRepresentation configuration) {
+ this.configuration = configuration;
+ }
+}
diff --git a/core/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java
new file mode 100644
index 0000000000..e38a900f03
--- /dev/null
+++ b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.keycloak.representations.idm;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+
+/**
+ * Just adds some type-safety to the ClientPolicyExecutorConfiguration
+ *
+ * @author Marek Posolda
+ */
+public class ClientPolicyExecutorConfigurationRepresentation {
+
+ private Map configAsMap = new HashMap<>();
+
+ @JsonAnyGetter
+ public Map getConfigAsMap() {
+ return configAsMap;
+ }
+
+ @JsonAnySetter
+ public void setConfigAsMap(String name, Object value) {
+ this.configAsMap.put(name, value);
+ }
+}
diff --git a/core/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java
new file mode 100644
index 0000000000..ab0f96d084
--- /dev/null
+++ b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.keycloak.representations.idm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Marek Posolda
+ */
+public class ClientPolicyExecutorRepresentation {
+
+ @JsonProperty("executor")
+ private String executorProviderId;
+
+ private ClientPolicyExecutorConfigurationRepresentation configuration;
+
+ public ClientPolicyExecutorRepresentation() {
+ }
+
+ public ClientPolicyExecutorRepresentation(String executorProviderId, ClientPolicyExecutorConfigurationRepresentation configuration) {
+ this.executorProviderId = executorProviderId;
+ this.configuration = configuration;
+ }
+
+ public String getExecutorProviderId() {
+ return executorProviderId;
+ }
+
+ public void setExecutorProviderId(String providerId) {
+ this.executorProviderId = providerId;
+ }
+
+ public ClientPolicyExecutorConfigurationRepresentation getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(ClientPolicyExecutorConfigurationRepresentation configuration) {
+ this.configuration = configuration;
+ }
+}
diff --git a/core/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java
index 8b623d213d..3674d8c5b7 100644
--- a/core/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java
+++ b/core/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java
@@ -19,21 +19,17 @@ package org.keycloak.representations.idm;
import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
/**
* Client Policy's external representation class
*
* @author Takashi Norimatsu
*/
-@JsonIgnoreProperties(ignoreUnknown = true)
public class ClientPolicyRepresentation {
protected String name;
protected String description;
- protected Boolean builtin;
- protected Boolean enable;
- protected List