You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by mm...@apache.org on 2020/02/27 08:17:32 UTC
[syncope] 03/12: resume on auth modules; clean up to base essentials
This is an automated email from the ASF dual-hosted git repository.
mmoayyed pushed a commit to branch SYNCOPE-163-1
in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 92d026f76f2e9c652bf6d1be5e8d86304bf086ea
Author: Misagh Moayyed <mm...@gmail.com>
AuthorDate: Mon Feb 24 13:27:37 2020 +0330
resume on auth modules; clean up to base essentials
---
.../common/lib/types/AMImplementationType.java | 8 +-
.../AbstractAuthenticationModuleConf.java | 63 ----------
.../AbstractAuthenticationPolicyConf.java | 53 --------
.../authentication/AuthenticationModuleConf.java | 40 ------
.../authentication/AuthenticationPolicyConf.java | 33 -----
.../ChainAuthenticationPolicyConf.java | 30 -----
.../DefaultAuthenticationModuleConf.java | 31 -----
.../DefaultAuthenticationPolicyConf.java | 59 ---------
.../FlowableAuthenticationPolicyConf.java | 30 -----
.../api/dao/AuthenticationModuleRule.java | 33 -----
.../api/dao/AuthenticationModuleRuleConfClass.java | 32 -----
.../api/dao/AuthenticationPolicyRule.java | 33 -----
.../api/dao/AuthenticationPolicyRuleConfClass.java | 32 -----
.../api/dao/AuthenticationPostProcessorRule.java | 23 ----
.../AuthenticationPostProcessorRuleConfClass.java | 23 ----
.../api/dao/AuthenticationPreProcessorRule.java | 30 -----
.../AuthenticationPreProcessorRuleConfClass.java | 23 ----
.../core/persistence/api/dao/PolicyDAO.java | 3 -
.../AuthenticationModuleDAO.java | 13 +-
.../authentication/AuthenticationPolicyDAO.java} | 22 ++--
.../OpenIdConnectRelyingPartyDAO.java} | 29 +++--
.../SAML2ServiceProviderDAO.java} | 27 ++--
.../syncope/core/persistence/api/entity/Realm.java | 22 ++--
.../authentication/AuthenticationModule.java | 14 +--
.../AuthenticationPostProcessor.java | 37 ------
...enticationChain.java => ClientApplication.java} | 9 +-
...ocessor.java => OpenIdConnectRelyingParty.java} | 20 +--
.../SAML2ServiceProvider.java} | 13 +-
.../api/entity/policy/AuthenticationPolicy.java | 37 ------
.../jpa/dao/JPAAuthenticationChainDAO.java | 76 ------------
.../jpa/dao/JPAAuthenticationProcessorDAO.java | 82 ------------
.../core/persistence/jpa/dao/JPAPolicyDAO.java | 12 --
.../JPAAuthenticationModuleDAO.java | 27 ++--
.../authentication/JPAAuthenticationPolicyDAO.java | 69 +++++++++++
.../authentication/JPAClientApplicationDAO.java | 69 +++++++++++
.../JPAOpenIdConnectRelyingPartyDAO.java | 112 +++++++++++++++++
.../authentication/JPASAML2ServiceProviderDAO.java | 112 +++++++++++++++++
.../persistence/jpa/entity/JPAEntityFactory.java | 114 ++++++++---------
.../core/persistence/jpa/entity/JPARealm.java | 54 +++-----
.../authentication/JPAAuthenticationModule.java | 57 +--------
.../JPAAuthenticationPostProcessor.java | 91 --------------
.../JPAAuthenticationPreProcessor.java | 64 ----------
...hain.java => JPAOpenIdConnectRelyingParty.java} | 93 ++++++++------
...Processor.java => JPASAML2ServiceProvider.java} | 69 +++++++----
.../jpa/entity/policy/JPAAccessPolicy.java | 33 -----
.../jpa/entity/policy/JPAAuthenticationPolicy.java | 137 +--------------------
.../jpa/inner/AuthenticationChainTest.java | 104 ----------------
.../jpa/inner/AuthenticationModuleTest.java | 25 +---
.../jpa/inner/AuthenticationPolicyTest.java | 79 ++++++++++++
.../jpa/inner/AuthenticationProcessorTest.java | 130 -------------------
.../persistence/jpa/inner/ImplementationTest.java | 14 +--
.../core/persistence/jpa/inner/PolicyTest.java | 92 +++-----------
.../src/test/resources/domains/MasterContent.xml | 32 +----
53 files changed, 746 insertions(+), 1823 deletions(-)
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMImplementationType.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMImplementationType.java
index d54bc1b..e2efc2c 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMImplementationType.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMImplementationType.java
@@ -19,13 +19,7 @@
package org.apache.syncope.common.lib.types;
public final class AMImplementationType {
-
- public static final String AUTH_CHAIN_RULES = "AUTH_CHAIN_RULES";
-
- public static final String AUTH_POST_PROCESSING = "AUTH_POST_PROCESSING";
-
- public static final String AUTH_PRE_PROCESSING = "AUTH_PRE_PROCESSING";
-
+
public static final String AUTH_MODULE_CONFIGURATIONS = "AUTH_MODULE_CONFIGURATIONS";
public static final String AUTH_POLICY_CONFIGURATIONS = "AUTH_POLICY_CONFIGURATIONS";
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AbstractAuthenticationModuleConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AbstractAuthenticationModuleConf.java
deleted file mode 100644
index c8b8e5c..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AbstractAuthenticationModuleConf.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import java.io.Serializable;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.commons.lang3.StringUtils;
-
-@XmlType
-@XmlSeeAlso({ DefaultAuthenticationModuleConf.class })
-public abstract class AbstractAuthenticationModuleConf implements Serializable, AuthenticationModuleConf {
-
- private static final long serialVersionUID = 4153200197344709778L;
-
- private String name;
-
- private int authenticationLevel;
-
- public AbstractAuthenticationModuleConf() {
- this(StringUtils.EMPTY);
- setName(getClass().getName());
- }
-
- public AbstractAuthenticationModuleConf(final String name) {
- super();
- this.name = name;
- }
-
- @Override
- public final String getName() {
- return name;
- }
-
- public final void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public int getAuthenticationLevel() {
- return authenticationLevel;
- }
-
- public void setAuthenticationLevel(final int authenticationLevel) {
- this.authenticationLevel = authenticationLevel;
- }
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AbstractAuthenticationPolicyConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AbstractAuthenticationPolicyConf.java
deleted file mode 100644
index 9db030d..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AbstractAuthenticationPolicyConf.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import java.io.Serializable;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.commons.lang3.StringUtils;
-
-@XmlType
-@XmlSeeAlso({ DefaultAuthenticationPolicyConf.class, ChainAuthenticationPolicyConf.class,
- FlowableAuthenticationPolicyConf.class })
-public abstract class AbstractAuthenticationPolicyConf implements Serializable, AuthenticationPolicyConf {
-
- private static final long serialVersionUID = 9185127128182430142L;
-
- private String name;
-
- public AbstractAuthenticationPolicyConf() {
- this(StringUtils.EMPTY);
- setName(getClass().getName());
- }
-
- public AbstractAuthenticationPolicyConf(final String name) {
- super();
- this.name = name;
- }
-
- @Override
- public final String getName() {
- return name;
- }
-
- public final void setName(final String name) {
- this.name = name;
- }
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AuthenticationModuleConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AuthenticationModuleConf.java
deleted file mode 100644
index 71348e1..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AuthenticationModuleConf.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import java.io.Serializable;
-
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public interface AuthenticationModuleConf extends Serializable {
-
- /**
- * Give name of related authentication module instance.
- *
- * @return name of this authentication module instance
- */
- String getName();
-
- /**
- * Give authentication level of related authentication module instance.
- *
- * @return authentication level of this authentication module instance
- */
- int getAuthenticationLevel();
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AuthenticationPolicyConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AuthenticationPolicyConf.java
deleted file mode 100644
index d8d3e4b..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/AuthenticationPolicyConf.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import java.io.Serializable;
-
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public interface AuthenticationPolicyConf extends Serializable {
-
- /**
- * Give name of related authentication policy instance.
- *
- * @return name of this authentication policy instance
- */
- String getName();
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/ChainAuthenticationPolicyConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/ChainAuthenticationPolicyConf.java
deleted file mode 100644
index 171f892..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/ChainAuthenticationPolicyConf.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "chainAuthenticationPolicyConf")
-@XmlType
-public class ChainAuthenticationPolicyConf extends AbstractAuthenticationPolicyConf {
-
- private static final long serialVersionUID = -984521961849586727L;
-
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/DefaultAuthenticationModuleConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/DefaultAuthenticationModuleConf.java
deleted file mode 100644
index 132a64b..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/DefaultAuthenticationModuleConf.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "defaultAuthenticationModuleConf")
-@XmlType
-public class DefaultAuthenticationModuleConf extends AbstractAuthenticationModuleConf {
-
- private static final long serialVersionUID = -7775771400318503131L;
-
-
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/DefaultAuthenticationPolicyConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/DefaultAuthenticationPolicyConf.java
deleted file mode 100644
index f4e4d3d..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/DefaultAuthenticationPolicyConf.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "defaultAuthenticationPolicyConf")
-@XmlType
-public class DefaultAuthenticationPolicyConf extends AbstractAuthenticationPolicyConf {
-
- private static final long serialVersionUID = 6021204813821798285L;
-
- /**
- * Authentication attribute.
- */
- private final List<String> authenticationAttributes = new ArrayList<>();
-
- /**
- * Case sensitive.
- */
- private boolean caseSensitiveAuthentication;
-
- public boolean isCaseSensitiveAuthentication() {
- return caseSensitiveAuthentication;
- }
-
- public void setCaseSensitiveAuthentication(final boolean caseSensitiveAuthentication) {
- this.caseSensitiveAuthentication = caseSensitiveAuthentication;
- }
-
- @XmlElementWrapper(name = "authenticationAttributes")
- @XmlElement(name = "attribute")
- @JsonProperty("authenticationAttributes")
- public List<String> getAuthenticationAttributes() {
- return authenticationAttributes;
- }
-}
diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/FlowableAuthenticationPolicyConf.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/FlowableAuthenticationPolicyConf.java
deleted file mode 100644
index db7a14a..0000000
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/authentication/FlowableAuthenticationPolicyConf.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.common.lib.authentication;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "flowableAuthenticationPolicyConf")
-@XmlType
-public class FlowableAuthenticationPolicyConf extends AbstractAuthenticationPolicyConf {
-
- private static final long serialVersionUID = -984521961849586727L;
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleRule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleRule.java
deleted file mode 100644
index ca89010..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleRule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-import org.apache.syncope.common.lib.authentication.AuthenticationPolicyConf;
-
-/**
- * Interface for authentication module rule to be evaluated during authentication.
- */
-public interface AuthenticationModuleRule {
-
- default void setConf(AuthenticationPolicyConf conf) {
- }
-
- void authenticate();
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleRuleConfClass.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleRuleConfClass.java
deleted file mode 100644
index f920a9b..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleRuleConfClass.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.syncope.common.lib.authentication.AuthenticationModuleConf;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface AuthenticationModuleRuleConfClass {
-
- Class<? extends AuthenticationModuleConf> value();
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPolicyRule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPolicyRule.java
deleted file mode 100644
index 27bd7f6..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPolicyRule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-import org.apache.syncope.common.lib.authentication.AuthenticationPolicyConf;
-
-/**
- * Interface for authentication policy rule to be evaluated during authentication.
- */
-public interface AuthenticationPolicyRule {
-
- default void setConf(AuthenticationPolicyConf conf) {
- }
-
- void authenticate();
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPolicyRuleConfClass.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPolicyRuleConfClass.java
deleted file mode 100644
index a4bc2d3..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPolicyRuleConfClass.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.syncope.common.lib.authentication.AuthenticationPolicyConf;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface AuthenticationPolicyRuleConfClass {
-
- Class<? extends AuthenticationPolicyConf> value();
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPostProcessorRule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPostProcessorRule.java
deleted file mode 100644
index 883a80d..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPostProcessorRule.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-public class AuthenticationPostProcessorRule {
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPostProcessorRuleConfClass.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPostProcessorRuleConfClass.java
deleted file mode 100644
index b002d30..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPostProcessorRuleConfClass.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-public class AuthenticationPostProcessorRuleConfClass {
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPreProcessorRule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPreProcessorRule.java
deleted file mode 100644
index b097541..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPreProcessorRule.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface AuthenticationPreProcessorRule {
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPreProcessorRuleConfClass.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPreProcessorRuleConfClass.java
deleted file mode 100644
index 040054c..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationPreProcessorRuleConfClass.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.dao;
-
-public class AuthenticationPreProcessorRuleConfClass {
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
index 8cedd32..6765030 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.dao;
import java.util.List;
import org.apache.syncope.core.persistence.api.entity.Implementation;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.Policy;
import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
@@ -41,8 +40,6 @@ public interface PolicyDAO extends DAO<Policy> {
List<PullPolicy> findByPullCorrelationRule(Implementation correlationRule);
List<PushPolicy> findByPushCorrelationRule(Implementation correlationRule);
-
- List<AuthenticationPolicy> findByAuthenticationPolicy(Implementation authenticationPolicy);
List<AccountPolicy> findByResource(ExternalResource resource);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/AuthenticationModuleDAO.java
similarity index 82%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleDAO.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/AuthenticationModuleDAO.java
index 4d48214..f439da7 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationModuleDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/AuthenticationModuleDAO.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,19 +14,19 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
-package org.apache.syncope.core.persistence.api.dao;
+package org.apache.syncope.core.persistence.api.dao.authentication;
-import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.dao.DAO;
import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
+import java.util.List;
+
public interface AuthenticationModuleDAO extends DAO<AuthenticationModule> {
AuthenticationModule find(String key);
- List<AuthenticationModule> findByConfiguration(Implementation configuration);
-
List<AuthenticationModule> findAll();
AuthenticationModule save(AuthenticationModule authenticationModule);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationProcessor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/AuthenticationPolicyDAO.java
similarity index 61%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationProcessor.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/AuthenticationPolicyDAO.java
index 197fd30..30f4276 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationProcessor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/AuthenticationPolicyDAO.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,20 +14,25 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
-package org.apache.syncope.core.persistence.api.entity.authentication;
+package org.apache.syncope.core.persistence.api.dao.authentication;
-import org.apache.syncope.core.persistence.api.entity.Entity;
+import org.apache.syncope.core.persistence.api.dao.DAO;
import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
-public interface AuthenticationProcessor extends Entity {
+import java.util.List;
+
+public interface AuthenticationPolicyDAO extends DAO<AuthenticationPolicy> {
+
+ AuthenticationPolicy find(String key);
- AuthenticationPolicy getAuthenticationPolicy();
+ List<AuthenticationPolicy> findAll();
- String getName();
+ AuthenticationPolicy save(AuthenticationPolicy authenticationModule);
- void setAuthenticationPolicy(AuthenticationPolicy authenticationPolicy);
+ void delete(String key);
- void setName(String name);
+ void delete(AuthenticationPolicy authenticationModule);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationProcessorDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/OpenIdConnectRelyingPartyDAO.java
similarity index 54%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationProcessorDAO.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/OpenIdConnectRelyingPartyDAO.java
index 92e40b9..51713eb 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationProcessorDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/OpenIdConnectRelyingPartyDAO.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,21 +14,31 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
-package org.apache.syncope.core.persistence.api.dao;
+package org.apache.syncope.core.persistence.api.dao.authentication;
+
+import org.apache.syncope.core.persistence.api.dao.DAO;
+import org.apache.syncope.core.persistence.api.entity.authentication.OpenIdConnectRelyingParty;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationProcessor;
-public interface AuthenticationProcessorDAO extends DAO<AuthenticationProcessor> {
+public interface OpenIdConnectRelyingPartyDAO extends DAO<OpenIdConnectRelyingParty> {
+
+ OpenIdConnectRelyingParty find(String key);
+
+ OpenIdConnectRelyingParty findByName(String name);
+
+ OpenIdConnectRelyingParty findByClientId(String clientId);
+
+ List<OpenIdConnectRelyingParty> findAll();
- <T extends AuthenticationProcessor> T find(String key);
+ OpenIdConnectRelyingParty save(OpenIdConnectRelyingParty application);
- <T extends AuthenticationProcessor> List<T> find(Class<T> reference);
+ void delete(String key);
- List<AuthenticationProcessor> findAll();
+ void deleteByClientId(String clientId);
- <T extends AuthenticationProcessor> T save(T authenticationProcessor);
+ void delete(OpenIdConnectRelyingParty application);
- <T extends AuthenticationProcessor> void delete(T authenticationProcessor);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationChainDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/SAML2ServiceProviderDAO.java
similarity index 58%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationChainDAO.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/SAML2ServiceProviderDAO.java
index a349844..8807cc5 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AuthenticationChainDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/authentication/SAML2ServiceProviderDAO.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,25 +14,31 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
-package org.apache.syncope.core.persistence.api.dao;
+package org.apache.syncope.core.persistence.api.dao.authentication;
+
+import org.apache.syncope.core.persistence.api.dao.DAO;
+import org.apache.syncope.core.persistence.api.entity.authentication.SAML2ServiceProvider;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationChain;
-public interface AuthenticationChainDAO extends DAO<AuthenticationChain> {
+public interface SAML2ServiceProviderDAO extends DAO<SAML2ServiceProvider> {
- AuthenticationChain find(String key);
+ SAML2ServiceProvider find(String key);
- List<AuthenticationChain> findByRule(Implementation configuration);
+ SAML2ServiceProvider findByName(String name);
- List<AuthenticationChain> findAll();
+ SAML2ServiceProvider findByEntityId(String clientId);
- AuthenticationChain save(AuthenticationChain authenticationChain);
+ List<SAML2ServiceProvider> findAll();
+
+ SAML2ServiceProvider save(SAML2ServiceProvider application);
void delete(String key);
- void delete(AuthenticationChain authenticationChain);
+ void deleteByEntityId(String entityId);
+
+ void delete(SAML2ServiceProvider application);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java
index 19c4e6c..f579702 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Realm.java
@@ -18,36 +18,32 @@
*/
package org.apache.syncope.core.persistence.api.entity;
-import java.util.List;
-import java.util.Optional;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
+import java.util.List;
+import java.util.Optional;
+
public interface Realm extends Entity {
String getName();
+ void setName(String name);
+
Realm getParent();
+ void setParent(Realm parent);
+
String getFullPath();
AccountPolicy getAccountPolicy();
- PasswordPolicy getPasswordPolicy();
-
- AuthenticationPolicy getAuthenticationPolicy();
-
- void setName(String name);
-
- void setParent(Realm parent);
-
void setAccountPolicy(AccountPolicy accountPolicy);
+ PasswordPolicy getPasswordPolicy();
+
void setPasswordPolicy(PasswordPolicy passwordPolicy);
-
- void setAuthenticationPolicy(AuthenticationPolicy authenticationPolicy);
boolean add(Implementation action);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationModule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationModule.java
index d1bf6b3..505df4f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationModule.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationModule.java
@@ -18,23 +18,11 @@
*/
package org.apache.syncope.core.persistence.api.entity.authentication;
-import java.util.List;
-import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.persistence.api.entity.Entity;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
public interface AuthenticationModule extends Entity {
- void setName(String displayName);
-
String getName();
- List<? extends Implementation> getConfigurations();
-
- boolean add(Implementation configuration);
-
- TraceLevel getTraceLevel();
-
- void setTraceLevel(TraceLevel createTraceLevel);
-
+ void setName(String name);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationPostProcessor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationPostProcessor.java
deleted file mode 100644
index 09e74cb..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationPostProcessor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.api.entity.authentication;
-
-import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-
-public interface AuthenticationPostProcessor extends AuthenticationProcessor {
-
- String getDefaultSuccessLoginURL();
-
- String getDefaultFailureLoginURL();
-
- List<? extends Implementation> getAuthenticationPostProcessing();
-
- void setDefaultSuccessLoginURL(String defaultSuccessLoginURL);
-
- void setDefaultFailureLoginURL(String defaultFailureLoginURL);
-
- boolean addAuthPostProcessing(Implementation authPostProcessing);
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationChain.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/ClientApplication.java
similarity index 80%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationChain.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/ClientApplication.java
index e2c5b2a..def140c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationChain.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/ClientApplication.java
@@ -18,11 +18,9 @@
*/
package org.apache.syncope.core.persistence.api.entity.authentication;
-import java.util.List;
import org.apache.syncope.core.persistence.api.entity.Entity;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-public interface AuthenticationChain extends Entity {
+public interface ClientApplication extends Entity {
String getName();
@@ -31,9 +29,4 @@ public interface AuthenticationChain extends Entity {
String getDescription();
void setDescription(String description);
-
- boolean add(Implementation configuration);
-
- List<? extends Implementation> getConfigurations();
-
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationPreProcessor.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/OpenIdConnectRelyingParty.java
similarity index 71%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationPreProcessor.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/OpenIdConnectRelyingParty.java
index aa41d65..6ad2cc5 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/AuthenticationPreProcessor.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/OpenIdConnectRelyingParty.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,16 +14,23 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
+
package org.apache.syncope.core.persistence.api.entity.authentication;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-public interface AuthenticationPreProcessor extends AuthenticationProcessor {
+public interface OpenIdConnectRelyingParty extends ClientApplication {
+ void setClientId(String id);
+
+ String getClientId();
+
+ void setClientSecret(String secret);
+
+ String getClientSecret();
- List<? extends Implementation> getAuthenticationPreProcessing();
-
- boolean addAuthPreProcessing(Implementation authPreProcessing);
+ List<String> getRedirectUris();
+ void setRedirectUris(List<String> uris);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccessPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/SAML2ServiceProvider.java
similarity index 70%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccessPolicy.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/SAML2ServiceProvider.java
index 2cb30d6..f42a30f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccessPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/authentication/SAML2ServiceProvider.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,11 +14,17 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
-package org.apache.syncope.core.persistence.api.entity.policy;
-public interface AccessPolicy extends Policy {
+package org.apache.syncope.core.persistence.api.entity.authentication;
+
+public interface SAML2ServiceProvider extends ClientApplication {
+ String getEntityId();
+ void setEntityId(String id);
+ String getMetadataLocation();
+ void setMetadataLocation(String location);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AuthenticationPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AuthenticationPolicy.java
index 20df9a6..774e83c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AuthenticationPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AuthenticationPolicy.java
@@ -18,46 +18,9 @@
*/
package org.apache.syncope.core.persistence.api.entity.policy;
-import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-
public interface AuthenticationPolicy extends Policy {
String getName();
- List<? extends Implementation> getConfigurations();
-
- int getMaxAuthenticationAttempts();
-
- int getAuthenticationAttemptsInterval();
-
- int getAuthenticationFailureLockoutDuration();
-
- String getLockoutAttributeName();
-
- String getLockoutAttributeValue();
-
- AuthenticationPostProcessor getAuthenticationPostProcessor();
-
- AuthenticationPreProcessor getAuthenticationPreProcessor();
-
void setName(String name);
-
- boolean addConfiguration(Implementation configuration);
-
- void setMaxAuthenticationAttempts(int maxAuthenticationAttempts);
-
- void setAuthenticationAttemptsInterval(int authenticationAttemptsInterval);
-
- void setAuthenticationFailureLockoutDuration(int authenticationFailureLockoutDuration);
-
- void setLockoutAttributeName(String lockoutAttributeName);
-
- void setLockoutAttributeValue(String lockoutAttributeValue);
-
- void setAuthenticationPostProcessor(AuthenticationPostProcessor authenticationPostProcessor);
-
- void setAuthenticationPreProcessor(AuthenticationPreProcessor authenticationPreProcessor);
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationChainDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationChainDAO.java
deleted file mode 100644
index f50c1a5..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationChainDAO.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.dao;
-
-import java.util.List;
-import javax.persistence.TypedQuery;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationChainDAO;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationChain;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationChain;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-@Repository
-public class JPAAuthenticationChainDAO extends AbstractDAO<AuthenticationChain> implements AuthenticationChainDAO {
-
- @Override
- public AuthenticationChain find(final String key) {
- return entityManager().find(JPAAuthenticationChain.class, key);
- }
-
- @Override
- public List<AuthenticationChain> findByRule(final Implementation configuration) {
- TypedQuery<AuthenticationChain> query = entityManager().createQuery(
- "SELECT e FROM " + JPAAuthenticationChain.class.getSimpleName() + " e "
- + "WHERE :rule MEMBER OF e.rules", AuthenticationChain.class);
- query.setParameter("rule", configuration);
- return query.getResultList();
- }
-
- @Transactional(readOnly = true)
- @Override
- public List<AuthenticationChain> findAll() {
- TypedQuery<AuthenticationChain> query = entityManager().createQuery(
- "SELECT e FROM " + JPAAuthenticationChain.class.getSimpleName() + " e", AuthenticationChain.class);
-
- return query.getResultList();
- }
-
- @Override
- public AuthenticationChain save(final AuthenticationChain authenticationChain) {
- return entityManager().merge(authenticationChain);
- }
-
- @Override
- public void delete(final String key) {
- AuthenticationChain authenticationChain = find(key);
- if (authenticationChain == null) {
- return;
- }
-
- delete(authenticationChain);
- }
-
- @Override
- public void delete(final AuthenticationChain authenticationChain) {
- entityManager().remove(authenticationChain);
- }
-
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationProcessorDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationProcessorDAO.java
deleted file mode 100644
index 1ae4bac..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationProcessorDAO.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.dao;
-
-import java.util.List;
-import javax.persistence.TypedQuery;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationProcessorDAO;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationProcessor;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.AbstractAuthenticationProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationPreProcessor;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public class JPAAuthenticationProcessorDAO extends AbstractDAO<AuthenticationProcessor> implements
- AuthenticationProcessorDAO {
-
- private <T extends AuthenticationProcessor> Class<? extends AbstractAuthenticationProcessor> getEntityReference(
- final Class<T> reference) {
- return AuthenticationPreProcessor.class.isAssignableFrom(reference)
- ? JPAAuthenticationPreProcessor.class
- : AuthenticationPostProcessor.class.isAssignableFrom(reference)
- ? JPAAuthenticationPostProcessor.class
- : null;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends AuthenticationProcessor> T find(final String key) {
- return (T) entityManager().find(AbstractAuthenticationProcessor.class, key);
- }
-
- @Override
- public <T extends AuthenticationProcessor> List<T> find(final Class<T> reference) {
- TypedQuery<T> query = entityManager().createQuery(
- "SELECT e FROM " + getEntityReference(reference).getSimpleName() + " e", reference);
-
- return query.getResultList();
- }
-
- public List<AuthenticationProcessor> findAll() {
- TypedQuery<AuthenticationProcessor> query = entityManager().createQuery(
- "SELECT e FROM " + AbstractAuthenticationProcessor.class.getSimpleName()
- + " e", AuthenticationProcessor.class);
- return query.getResultList();
- }
-
- @Override
- public <T extends AuthenticationProcessor> T save(final T authenticationProcessor) {
- return entityManager().merge(authenticationProcessor);
- }
-
- @Override
- public <T extends AuthenticationProcessor> void delete(final T authenticationProcessor) {
- AuthenticationPolicy policy = authenticationProcessor.getAuthenticationPolicy();
- if (authenticationProcessor instanceof AuthenticationPreProcessor) {
- policy.setAuthenticationPreProcessor(null);
- } else {
- policy.setAuthenticationPostProcessor(null);
- }
- entityManager().remove(authenticationProcessor);
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index 4773ae9..2b26627 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -123,16 +123,6 @@ public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
}
@Override
- public List<AuthenticationPolicy> findByAuthenticationPolicy(final Implementation authenticationRule) {
- TypedQuery<AuthenticationPolicy> query = entityManager().createQuery(
- "SELECT e FROM " + JPAAuthenticationPolicy.class.getSimpleName() + " e "
- + "WHERE :authenticationRule MEMBER OF e.configurations", AuthenticationPolicy.class);
- query.setParameter("authenticationRule", authenticationRule);
-
- return query.getResultList();
- }
-
- @Override
public List<AccountPolicy> findByResource(final ExternalResource resource) {
TypedQuery<AccountPolicy> query = entityManager().createQuery(
"SELECT e FROM " + JPAAccountPolicy.class.getSimpleName() + " e "
@@ -161,8 +151,6 @@ public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
realm.setAccountPolicy(null);
} else if (policy instanceof PasswordPolicy) {
realm.setPasswordPolicy(null);
- } else if (policy instanceof AuthenticationPolicy) {
- realm.setAuthenticationPolicy(null);
}
});
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationModuleDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAAuthenticationModuleDAO.java
similarity index 72%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationModuleDAO.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAAuthenticationModuleDAO.java
index 99d335d..f298152 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAuthenticationModuleDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAAuthenticationModuleDAO.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,18 +14,21 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
-package org.apache.syncope.core.persistence.jpa.dao;
+package org.apache.syncope.core.persistence.jpa.dao.authentication;
-import java.util.List;
-import javax.persistence.TypedQuery;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationModuleDAO;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.dao.authentication.AuthenticationModuleDAO;
import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
+import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationModule;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
+import javax.persistence.TypedQuery;
+
+import java.util.List;
+
@Repository
public class JPAAuthenticationModuleDAO extends AbstractDAO<AuthenticationModule> implements AuthenticationModuleDAO {
@@ -35,20 +37,11 @@ public class JPAAuthenticationModuleDAO extends AbstractDAO<AuthenticationModule
return entityManager().find(JPAAuthenticationModule.class, key);
}
- @Override
- public List<AuthenticationModule> findByConfiguration(final Implementation configuration) {
- TypedQuery<AuthenticationModule> query = entityManager().createQuery(
- "SELECT e FROM " + JPAAuthenticationModule.class.getSimpleName() + " e "
- + "WHERE :configuration MEMBER OF e.configurations", AuthenticationModule.class);
- query.setParameter("configuration", configuration);
- return query.getResultList();
- }
-
@Transactional(readOnly = true)
@Override
public List<AuthenticationModule> findAll() {
TypedQuery<AuthenticationModule> query = entityManager().createQuery(
- "SELECT e FROM " + JPAAuthenticationModule.class.getSimpleName() + " e", AuthenticationModule.class);
+ "SELECT e FROM " + JPAAuthenticationModule.class.getSimpleName() + " e", AuthenticationModule.class);
return query.getResultList();
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAAuthenticationPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAAuthenticationPolicyDAO.java
new file mode 100644
index 0000000..388b7f2
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAAuthenticationPolicyDAO.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.core.persistence.jpa.dao.authentication;
+
+import org.apache.syncope.core.persistence.api.dao.authentication.AuthenticationPolicyDAO;
+import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
+import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAuthenticationPolicy;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.TypedQuery;
+
+import java.util.List;
+
+@Repository
+public class JPAAuthenticationPolicyDAO extends AbstractDAO<AuthenticationPolicy> implements AuthenticationPolicyDAO {
+
+ @Override
+ public AuthenticationPolicy find(final String key) {
+ return entityManager().find(JPAAuthenticationPolicy.class, key);
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public List<AuthenticationPolicy> findAll() {
+ TypedQuery<AuthenticationPolicy> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAAuthenticationPolicy.class.getSimpleName() + " e", AuthenticationPolicy.class);
+
+ return query.getResultList();
+ }
+
+ @Override
+ public AuthenticationPolicy save(final AuthenticationPolicy policy) {
+ return entityManager().merge(policy);
+ }
+
+ @Override
+ public void delete(final String key) {
+ AuthenticationPolicy policy = find(key);
+ if (policy == null) {
+ return;
+ }
+
+ delete(policy);
+ }
+
+ @Override
+ public void delete(final AuthenticationPolicy policy) {
+ entityManager().remove(policy);
+ }
+
+}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAClientApplicationDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAClientApplicationDAO.java
new file mode 100644
index 0000000..7e8d1ce
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAClientApplicationDAO.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.core.persistence.jpa.dao.authentication;
+
+import org.apache.syncope.core.persistence.api.dao.authentication.AuthenticationPolicyDAO;
+import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
+import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAuthenticationPolicy;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.TypedQuery;
+
+import java.util.List;
+
+@Repository
+public class JPAClientApplicationDAO extends AbstractDAO<AuthenticationPolicy> implements AuthenticationPolicyDAO {
+
+ @Override
+ public AuthenticationPolicy find(final String key) {
+ return entityManager().find(JPAAuthenticationPolicy.class, key);
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public List<AuthenticationPolicy> findAll() {
+ TypedQuery<AuthenticationPolicy> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAAuthenticationPolicy.class.getSimpleName() + " e", AuthenticationPolicy.class);
+
+ return query.getResultList();
+ }
+
+ @Override
+ public AuthenticationPolicy save(final AuthenticationPolicy policy) {
+ return entityManager().merge(policy);
+ }
+
+ @Override
+ public void delete(final String key) {
+ AuthenticationPolicy policy = find(key);
+ if (policy == null) {
+ return;
+ }
+
+ delete(policy);
+ }
+
+ @Override
+ public void delete(final AuthenticationPolicy policy) {
+ entityManager().remove(policy);
+ }
+
+}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAOpenIdConnectRelyingPartyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAOpenIdConnectRelyingPartyDAO.java
new file mode 100644
index 0000000..b6b3355
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPAOpenIdConnectRelyingPartyDAO.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.core.persistence.jpa.dao.authentication;
+
+import org.apache.syncope.core.persistence.api.dao.authentication.OpenIdConnectRelyingPartyDAO;
+import org.apache.syncope.core.persistence.api.entity.authentication.OpenIdConnectRelyingParty;
+import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
+import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAOpenIdConnectRelyingParty;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.NoResultException;
+import javax.persistence.TypedQuery;
+
+import java.util.List;
+
+@Repository
+public class JPAOpenIdConnectRelyingPartyDAO extends AbstractDAO<OpenIdConnectRelyingParty>
+ implements OpenIdConnectRelyingPartyDAO {
+
+ @Override
+ public OpenIdConnectRelyingParty find(final String key) {
+ return entityManager().find(JPAOpenIdConnectRelyingParty.class, key);
+ }
+
+ @Override
+ public OpenIdConnectRelyingParty findByName(final String name) {
+ TypedQuery<OpenIdConnectRelyingParty> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAOpenIdConnectRelyingParty.class.getSimpleName() + " e WHERE e.name=:name", OpenIdConnectRelyingParty.class);
+ query.setParameter("name", name);
+
+ OpenIdConnectRelyingParty result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (NoResultException e) {
+ LOG.debug("No OpenIdConnectRelyingParty found with name {}", name, e);
+ }
+
+ return result;
+ }
+
+ @Override
+ public OpenIdConnectRelyingParty findByClientId(final String clientId) {
+ TypedQuery<OpenIdConnectRelyingParty> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAOpenIdConnectRelyingParty.class.getSimpleName() + " e WHERE e.clientId=:clientId", OpenIdConnectRelyingParty.class);
+ query.setParameter(clientId, clientId);
+
+ OpenIdConnectRelyingParty result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (NoResultException e) {
+ LOG.debug("No OpenIdConnectRelyingParty found with clientId {}", clientId, e);
+ }
+
+ return result;
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public List<OpenIdConnectRelyingParty> findAll() {
+ TypedQuery<OpenIdConnectRelyingParty> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAOpenIdConnectRelyingParty.class.getSimpleName() + " e", OpenIdConnectRelyingParty.class);
+
+ return query.getResultList();
+ }
+
+ @Override
+ public OpenIdConnectRelyingParty save(final OpenIdConnectRelyingParty policy) {
+ return entityManager().merge(policy);
+ }
+
+ @Override
+ public void delete(final String key) {
+ OpenIdConnectRelyingParty policy = find(key);
+ if (policy == null) {
+ return;
+ }
+
+ delete(policy);
+ }
+
+ @Override
+ public void deleteByClientId(final String clientId) {
+ OpenIdConnectRelyingParty policy = findByClientId(clientId);
+ if (policy == null) {
+ return;
+ }
+ delete(policy);
+ }
+
+ @Override
+ public void delete(final OpenIdConnectRelyingParty policy) {
+ entityManager().remove(policy);
+ }
+}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPASAML2ServiceProviderDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPASAML2ServiceProviderDAO.java
new file mode 100644
index 0000000..1254583
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/authentication/JPASAML2ServiceProviderDAO.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.core.persistence.jpa.dao.authentication;
+
+import org.apache.syncope.core.persistence.api.dao.authentication.SAML2ServiceProviderDAO;
+import org.apache.syncope.core.persistence.api.entity.authentication.SAML2ServiceProvider;
+import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
+import org.apache.syncope.core.persistence.jpa.entity.authentication.JPASAML2ServiceProvider;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.NoResultException;
+import javax.persistence.TypedQuery;
+
+import java.util.List;
+
+@Repository
+public class JPASAML2ServiceProviderDAO extends AbstractDAO<SAML2ServiceProvider>
+ implements SAML2ServiceProviderDAO {
+
+ @Override
+ public SAML2ServiceProvider find(final String key) {
+ return entityManager().find(JPASAML2ServiceProvider.class, key);
+ }
+
+ @Override
+ public SAML2ServiceProvider findByName(final String name) {
+ final TypedQuery<SAML2ServiceProvider> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2ServiceProvider.class.getSimpleName() + " e WHERE e.name=:name", SAML2ServiceProvider.class);
+ query.setParameter("name", name);
+
+ SAML2ServiceProvider result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (final NoResultException e) {
+ LOG.debug("No SAML2ServiceProvider found with name {}", name, e);
+ }
+
+ return result;
+ }
+
+ @Override
+ public SAML2ServiceProvider findByEntityId(final String entityId) {
+ final TypedQuery<SAML2ServiceProvider> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2ServiceProvider.class.getSimpleName() + " e WHERE e.entityId=:entityId", SAML2ServiceProvider.class);
+ query.setParameter("entityId", entityId);
+
+ SAML2ServiceProvider result = null;
+ try {
+ result = query.getSingleResult();
+ } catch (final NoResultException e) {
+ LOG.debug("No SAML2ServiceProvider found with clientId {}", entityId, e);
+ }
+
+ return result;
+ }
+
+ @Transactional(readOnly = true)
+ @Override
+ public List<SAML2ServiceProvider> findAll() {
+ final TypedQuery<SAML2ServiceProvider> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2ServiceProvider.class.getSimpleName() + " e", SAML2ServiceProvider.class);
+
+ return query.getResultList();
+ }
+
+ @Override
+ public SAML2ServiceProvider save(final SAML2ServiceProvider policy) {
+ return entityManager().merge(policy);
+ }
+
+ @Override
+ public void delete(final String key) {
+ final SAML2ServiceProvider policy = find(key);
+ if (policy == null) {
+ return;
+ }
+
+ delete(policy);
+ }
+
+ @Override
+ public void deleteByEntityId(final String entityId) {
+ final SAML2ServiceProvider app = findByEntityId(entityId);
+ if (app == null) {
+ return;
+ }
+ delete(app);
+ }
+
+ @Override
+ public void delete(final SAML2ServiceProvider policy) {
+ entityManager().remove(policy);
+ }
+}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 25dc089..1f19263 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -19,15 +19,7 @@
package org.apache.syncope.core.persistence.jpa.entity;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPASecurityQuestion;
import org.apache.syncope.core.persistence.api.entity.AccessToken;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPADynRoleMembership;
-import org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResource;
-import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.AnyAbout;
import org.apache.syncope.core.persistence.api.entity.AnyTemplateRealm;
import org.apache.syncope.core.persistence.api.entity.AnyType;
@@ -37,22 +29,25 @@ import org.apache.syncope.core.persistence.api.entity.Batch;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
-import org.apache.syncope.core.persistence.api.entity.user.DynRoleMembership;
+import org.apache.syncope.core.persistence.api.entity.DynRealm;
+import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.GatewayRoute;
+import org.apache.syncope.core.persistence.api.entity.Implementation;
import org.apache.syncope.core.persistence.api.entity.Logger;
import org.apache.syncope.core.persistence.api.entity.MailTemplate;
import org.apache.syncope.core.persistence.api.entity.Notification;
-import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
+import org.apache.syncope.core.persistence.api.entity.Privilege;
import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.RelationshipType;
+import org.apache.syncope.core.persistence.api.entity.Remediation;
import org.apache.syncope.core.persistence.api.entity.Report;
import org.apache.syncope.core.persistence.api.entity.ReportExec;
import org.apache.syncope.core.persistence.api.entity.ReportTemplate;
import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.SchemaLabel;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
@@ -61,20 +56,40 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.APlainAttrUnique
import org.apache.syncope.core.persistence.api.entity.anyobject.APlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.anyobject.ARelationship;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
+import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
+import org.apache.syncope.core.persistence.api.entity.authentication.OpenIdConnectRelyingParty;
+import org.apache.syncope.core.persistence.api.entity.authentication.SAML2ServiceProvider;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.group.TypeExtension;
+import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PullCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
+import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.resource.OrgUnit;
+import org.apache.syncope.core.persistence.api.entity.resource.OrgUnitItem;
import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.apache.syncope.core.persistence.api.entity.task.AnyTemplatePullTask;
import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.persistence.api.entity.task.PullTask;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.task.PushTaskAnyFilter;
import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
+import org.apache.syncope.core.persistence.api.entity.user.DynRoleMembership;
+import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount;
import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
@@ -83,6 +98,7 @@ import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrUniqueValue
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.user.URelationship;
import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.persistence.jpa.dao.JPAAnySearchDAO;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAMembership;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttr;
@@ -90,22 +106,41 @@ import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrUni
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrValue;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAARelationship;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
+import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationModule;
+import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAOpenIdConnectRelyingParty;
+import org.apache.syncope.core.persistence.jpa.entity.authentication.JPASAML2ServiceProvider;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.core.persistence.jpa.entity.group.JPATypeExtension;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAuthenticationPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResource;
import org.apache.syncope.core.persistence.jpa.entity.resource.JPAMapping;
import org.apache.syncope.core.persistence.jpa.entity.resource.JPAMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.resource.JPAOrgUnit;
+import org.apache.syncope.core.persistence.jpa.entity.resource.JPAOrgUnitItem;
import org.apache.syncope.core.persistence.jpa.entity.resource.JPAProvision;
-import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTaskAnyFilter;
import org.apache.syncope.core.persistence.jpa.entity.task.JPAAnyTemplatePullTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPANotificationTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPAPropagationTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPAPullTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTaskAnyFilter;
import org.apache.syncope.core.persistence.jpa.entity.task.JPASchedTask;
-import org.apache.syncope.core.persistence.jpa.entity.task.JPAPullTask;
import org.apache.syncope.core.persistence.jpa.entity.task.JPATaskExec;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPADynRoleMembership;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPALAPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPALAPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPALAPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPALinkedAccount;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPASecurityQuestion;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMembership;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
@@ -113,45 +148,6 @@ import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueVa
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAURelationship;
import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
-import org.apache.syncope.core.persistence.api.entity.task.PullTask;
-import org.apache.syncope.core.persistence.api.entity.task.AnyTemplatePullTask;
-import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
-import org.apache.syncope.core.persistence.api.entity.resource.OrgUnit;
-import org.apache.syncope.core.persistence.jpa.entity.resource.JPAOrgUnit;
-import org.apache.syncope.core.persistence.api.entity.DynRealm;
-import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
-import org.apache.syncope.core.persistence.api.entity.GatewayRoute;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.Privilege;
-import org.apache.syncope.core.persistence.api.entity.Remediation;
-import org.apache.syncope.core.persistence.api.entity.SchemaLabel;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationChain;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.api.entity.policy.AccessPolicy;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
-import org.apache.syncope.core.persistence.api.entity.resource.OrgUnitItem;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullCorrelationRuleEntity;
-import org.apache.syncope.core.persistence.jpa.entity.resource.JPAOrgUnitItem;
-import org.apache.syncope.core.persistence.api.entity.policy.PullCorrelationRuleEntity;
-import org.apache.syncope.core.persistence.api.entity.policy.PushCorrelationRuleEntity;
-import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttr;
-import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount;
-import org.apache.syncope.core.persistence.jpa.dao.JPAAnySearchDAO;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationChain;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationModule;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccessPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAuthenticationPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushCorrelationRuleEntity;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPALAPlainAttr;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPALAPlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPALAPlainAttrValue;
-import org.apache.syncope.core.persistence.jpa.entity.user.JPALinkedAccount;
import org.apache.syncope.core.spring.security.SecureRandomUtils;
public class JPAEntityFactory implements EntityFactory {
@@ -307,16 +303,12 @@ public class JPAEntityFactory implements EntityFactory {
result = (E) new JPAGatewayRoute();
} else if (reference.equals(AuthenticationModule.class)) {
result = (E) new JPAAuthenticationModule();
- } else if (reference.equals(AuthenticationChain.class)) {
- result = (E) new JPAAuthenticationChain();
} else if (reference.equals(AuthenticationPolicy.class)) {
result = (E) new JPAAuthenticationPolicy();
- } else if (reference.equals(AuthenticationPostProcessor.class)) {
- result = (E) new JPAAuthenticationPostProcessor();
- } else if (reference.equals(AuthenticationPreProcessor.class)) {
- result = (E) new JPAAuthenticationPreProcessor();
- } else if (reference.equals(AccessPolicy.class)) {
- result = (E) new JPAAccessPolicy();
+ } else if (reference.equals(OpenIdConnectRelyingParty.class)) {
+ result = (E) new JPAOpenIdConnectRelyingParty();
+ } else if (reference.equals(SAML2ServiceProvider.class)) {
+ result = (E) new JPASAML2ServiceProvider();
} else {
throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
index e7b07ac..129fd1c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPARealm.java
@@ -18,39 +18,39 @@
*/
package org.apache.syncope.core.persistence.jpa.entity;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-import javax.persistence.Cacheable;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-import javax.validation.constraints.Size;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.IdRepoImplementationType;
import org.apache.syncope.core.persistence.api.entity.AnyTemplateRealm;
import org.apache.syncope.core.persistence.api.entity.AnyType;
import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.entity.Realm;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAuthenticationPolicy;
import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordPolicy;
import org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResource;
import org.apache.syncope.core.persistence.jpa.validation.entity.RealmCheck;
+import javax.persistence.Cacheable;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.validation.constraints.Size;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
@Entity
@Table(name = JPARealm.TABLE, uniqueConstraints =
@UniqueConstraint(columnNames = { "name", "parent_id" }))
@@ -74,9 +74,6 @@ public class JPARealm extends AbstractGeneratedKeyEntity implements Realm {
@ManyToOne(fetch = FetchType.EAGER)
private JPAAccountPolicy accountPolicy;
- @ManyToOne(fetch = FetchType.EAGER)
- private JPAAuthenticationPolicy authenticationPolicy;
-
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = TABLE + "Action",
joinColumns =
@@ -127,13 +124,6 @@ public class JPARealm extends AbstractGeneratedKeyEntity implements Realm {
}
@Override
- public AuthenticationPolicy getAuthenticationPolicy() {
- return authenticationPolicy == null && getParent() != null
- ? getParent().getAuthenticationPolicy()
- : authenticationPolicy;
- }
-
- @Override
public void setName(final String name) {
this.name = name;
}
@@ -157,12 +147,6 @@ public class JPARealm extends AbstractGeneratedKeyEntity implements Realm {
}
@Override
- public void setAuthenticationPolicy(final AuthenticationPolicy authenticationPolicy) {
- checkType(authenticationPolicy, JPAAuthenticationPolicy.class);
- this.authenticationPolicy = (JPAAuthenticationPolicy) authenticationPolicy;
- }
-
- @Override
public boolean add(final Implementation action) {
checkType(action, JPAImplementation.class);
checkImplementationType(action, IdRepoImplementationType.LOGIC_ACTIONS);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationModule.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationModule.java
index b772443..3a3c523 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationModule.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationModule.java
@@ -18,49 +18,24 @@
*/
package org.apache.syncope.core.persistence.jpa.entity.authentication;
+import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
-import java.util.ArrayList;
-import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
-import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
@Entity
@Table(name = JPAAuthenticationModule.TABLE)
public class JPAAuthenticationModule extends AbstractGeneratedKeyEntity implements AuthenticationModule {
- private static final long serialVersionUID = 7422422526695279794L;
-
public static final String TABLE = "AuthenticationModule";
+ private static final long serialVersionUID = 7422422526695279794L;
+
@Column(unique = true, nullable = false)
private String name;
- @Enumerated(EnumType.STRING)
- @NotNull
- private TraceLevel traceLevel = TraceLevel.FAILURES;
-
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = TABLE + "Conf",
- joinColumns =
- @JoinColumn(name = "authentication_module_id"),
- inverseJoinColumns =
- @JoinColumn(name = "implementation_id"))
- private List<JPAImplementation> configurations = new ArrayList<>();
-
@Override
public String getName() {
return name;
@@ -70,28 +45,4 @@ public class JPAAuthenticationModule extends AbstractGeneratedKeyEntity implemen
public void setName(final String name) {
this.name = name;
}
-
- @Override
- public TraceLevel getTraceLevel() {
- return traceLevel;
- }
-
- @Override
- public List<? extends Implementation> getConfigurations() {
- return configurations;
- }
-
- @Override
- public void setTraceLevel(final TraceLevel createTraceLevel) {
- this.traceLevel = createTraceLevel;
- }
-
- @Override
- public boolean add(final Implementation configuration) {
- checkType(configuration, JPAImplementation.class);
- checkImplementationType(configuration, AMImplementationType.AUTH_MODULE_CONFIGURATIONS);
- return configurations.contains((JPAImplementation) configuration)
- || configurations.add((JPAImplementation) configuration);
- }
-
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationPostProcessor.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationPostProcessor.java
deleted file mode 100644
index 721194f..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationPostProcessor.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.entity.authentication;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
-
-@Entity
-@Table(name = JPAAuthenticationPostProcessor.TABLE)
-public class JPAAuthenticationPostProcessor
- extends AbstractAuthenticationProcessor implements AuthenticationPostProcessor {
-
- private static final long serialVersionUID = 8759966056325625080L;
-
- public static final String TABLE = "AuthenticationPostProcessor";
-
- @NotNull
- private String defaultSuccessLoginURL;
-
- @NotNull
- private String defaultFailureLoginURL;
-
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = TABLE + "Actions",
- joinColumns =
- @JoinColumn(name = "authentication_post_processor"),
- inverseJoinColumns =
- @JoinColumn(name = "implementation_id"))
- private List<JPAImplementation> authenticationPostProcessing = new ArrayList<>();
-
- @Override
- public String getDefaultSuccessLoginURL() {
- return defaultSuccessLoginURL;
- }
-
- @Override
- public String getDefaultFailureLoginURL() {
- return defaultFailureLoginURL;
- }
-
- @Override
- public List<? extends Implementation> getAuthenticationPostProcessing() {
- return authenticationPostProcessing;
- }
-
- @Override
- public void setDefaultSuccessLoginURL(final String defaultSuccessLoginURL) {
- this.defaultSuccessLoginURL = defaultSuccessLoginURL;
- }
-
- @Override
- public void setDefaultFailureLoginURL(final String defaultFailureLoginURL) {
- this.defaultFailureLoginURL = defaultFailureLoginURL;
- }
-
- @Override
- public boolean addAuthPostProcessing(final Implementation authPreProcessing) {
- checkType(authPreProcessing, JPAImplementation.class);
- checkImplementationType(authPreProcessing, AMImplementationType.AUTH_POST_PROCESSING);
- return authenticationPostProcessing.contains((JPAImplementation) authPreProcessing)
- || authenticationPostProcessing.add((JPAImplementation) authPreProcessing);
- }
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationPreProcessor.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationPreProcessor.java
deleted file mode 100644
index 9c36478..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationPreProcessor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.entity.authentication;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
-
-@Entity
-@Table(name = JPAAuthenticationPreProcessor.TABLE)
-public class JPAAuthenticationPreProcessor
- extends AbstractAuthenticationProcessor implements AuthenticationPreProcessor {
-
- private static final long serialVersionUID = -3064505653663946579L;
-
- public static final String TABLE = "AuthenticationPreProcessor";
-
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = TABLE + "Actions",
- joinColumns =
- @JoinColumn(name = "authentication_pre_processor"),
- inverseJoinColumns =
- @JoinColumn(name = "implementation_id"))
- private List<JPAImplementation> authenticationPreProcessing = new ArrayList<>();
-
- @Override
- public List<? extends Implementation> getAuthenticationPreProcessing() {
- return authenticationPreProcessing;
- }
-
- @Override
- public boolean addAuthPreProcessing(final Implementation authPreProcessing) {
- checkType(authPreProcessing, JPAImplementation.class);
- checkImplementationType(authPreProcessing, AMImplementationType.AUTH_PRE_PROCESSING);
- return authenticationPreProcessing.contains((JPAImplementation) authPreProcessing)
- || authenticationPreProcessing.add((JPAImplementation) authPreProcessing);
- }
-
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationChain.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAOpenIdConnectRelyingParty.java
similarity index 53%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationChain.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAOpenIdConnectRelyingParty.java
index b3fffa0..6acd0ea 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAAuthenticationChain.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPAOpenIdConnectRelyingParty.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,76 +14,98 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
+
package org.apache.syncope.core.persistence.jpa.entity.authentication;
-import java.util.ArrayList;
-import java.util.List;
+import org.apache.syncope.core.persistence.api.entity.authentication.OpenIdConnectRelyingParty;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
+
+import javax.persistence.CollectionTable;
import javax.persistence.Column;
+import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
import javax.persistence.Table;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationChain;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
-import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
+
+import java.util.ArrayList;
+import java.util.List;
@Entity
-@Table(name = JPAAuthenticationChain.TABLE)
-public class JPAAuthenticationChain extends AbstractGeneratedKeyEntity implements AuthenticationChain {
+@Table(name = JPAOpenIdConnectRelyingParty.TABLE)
+public class JPAOpenIdConnectRelyingParty extends AbstractGeneratedKeyEntity implements OpenIdConnectRelyingParty {
- private static final long serialVersionUID = -1169616553574108334L;
+ public static final String TABLE = "OpenIdConnectRelyingParty";
- public static final String TABLE = "AuthenticationChain";
+ private static final long serialVersionUID = 7422422526695279794L;
@Column(unique = true, nullable = false)
private String name;
- @Column(unique = false, nullable = true)
+ @Column(unique = true, nullable = false)
private String description;
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = TABLE + "Conf",
- joinColumns =
- @JoinColumn(name = "authentication_chain_id"),
- inverseJoinColumns =
- @JoinColumn(name = "implementation_id"))
- private List<JPAImplementation> configurations = new ArrayList<>();
+ @Column(unique = true, nullable = false)
+ private String clientId;
+
+ @Column
+ private String clientSecret;
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @Column(name = "redirectUris")
+ @CollectionTable(name = "OpenIdConnectRelyingParty_RedirectUris", joinColumns = @JoinColumn(name = "clientId"))
+ private List<String> redirectUris = new ArrayList<>();
@Override
public String getName() {
return name;
+ } @Override
+ public List<String> getRedirectUris() {
+ return redirectUris;
}
@Override
- public String getDescription() {
- return description;
+ public void setName(final String name) {
+ this.name = name;
+ } @Override
+ public void setRedirectUris(final List<String> redirectUris) {
+ this.redirectUris = redirectUris;
}
@Override
- public List<? extends Implementation> getConfigurations() {
- return configurations;
+ public String getDescription() {
+ return description;
+ } @Override
+ public String getClientId() {
+ return clientId;
}
@Override
- public void setName(final String name) {
- this.name = name;
+ public void setDescription(final String description) {
+ this.description = description;
+ } @Override
+ public void setClientId(final String clientId) {
+ this.clientId = clientId;
}
@Override
- public void setDescription(final String description) {
- this.description = description;
+ public String getClientSecret() {
+ return clientSecret;
}
@Override
- public boolean add(final Implementation configuration) {
- checkType(configuration, JPAImplementation.class);
- checkImplementationType(configuration, AMImplementationType.AUTH_CHAIN_RULES);
- return configurations.contains((JPAImplementation) configuration)
- || configurations.add((JPAImplementation) configuration);
+ public void setClientSecret(final String clientSecret) {
+ this.clientSecret = clientSecret;
}
+
+
+
+
+
+
+
+
}
+
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/AbstractAuthenticationProcessor.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPASAML2ServiceProvider.java
similarity index 51%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/AbstractAuthenticationProcessor.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPASAML2ServiceProvider.java
index be02256..79de4a2 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/AbstractAuthenticationProcessor.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/authentication/JPASAML2ServiceProvider.java
@@ -6,8 +6,7 @@
* to you 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
+ * 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
@@ -15,48 +14,74 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
+
package org.apache.syncope.core.persistence.jpa.entity.authentication;
+import org.apache.syncope.core.persistence.api.entity.authentication.SAML2ServiceProvider;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.OneToOne;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationProcessor;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAuthenticationPolicy;
+import javax.persistence.Table;
@Entity
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-public abstract class AbstractAuthenticationProcessor extends AbstractGeneratedKeyEntity
- implements AuthenticationProcessor {
+@Table(name = JPASAML2ServiceProvider.TABLE)
+public class JPASAML2ServiceProvider extends AbstractGeneratedKeyEntity implements SAML2ServiceProvider {
+ public static final String TABLE = "SAML2ServiceProvider";
- private static final long serialVersionUID = -1419270763197087924L;
+ private static final long serialVersionUID = 6422422526695279794L;
@Column(unique = true, nullable = false)
private String name;
+ @Column(unique = true, nullable = false)
+ private String description;
+
+ @Column(unique = true, nullable = false)
+ private String entityId;
+
+ @Column(nullable = false)
+ private String metadataLocation;
+
@Override
- public String getName() {
- return name;
+ public String getEntityId() {
+ return entityId;
+ }
+
+ @Override
+ public void setEntityId(final String entityId) {
+ this.entityId = entityId;
}
- @OneToOne(optional = false)
- private JPAAuthenticationPolicy authenticationPolicy;
+ @Override
+ public String getMetadataLocation() {
+ return metadataLocation;
+ }
- public AuthenticationPolicy getAuthenticationPolicy() {
- return authenticationPolicy;
+ @Override
+ public void setMetadataLocation(final String metadataLocation) {
+ this.metadataLocation = metadataLocation;
}
- public void setAuthenticationPolicy(final AuthenticationPolicy authenticationPolicy) {
- checkType(authenticationPolicy, JPAAuthenticationPolicy.class);
- this.authenticationPolicy = (JPAAuthenticationPolicy) authenticationPolicy;
+ @Override
+ public String getName() {
+ return name;
}
@Override
public void setName(final String name) {
this.name = name;
}
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public void setDescription(final String description) {
+ this.description = description;
+ }
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAccessPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAccessPolicy.java
deleted file mode 100644
index 4c6221e..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAccessPolicy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.entity.policy;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.policy.AccessPolicy;
-
-@Entity
-@Table(name = JPAAccessPolicy.TABLE)
-public class JPAAccessPolicy extends AbstractPolicy implements AccessPolicy {
-
- private static final long serialVersionUID = -6284704337579924774L;
-
- public static final String TABLE = "AccessPolicy";
-
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAuthenticationPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAuthenticationPolicy.java
index 9ea9cea..f43fd7d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAuthenticationPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAAuthenticationPolicy.java
@@ -18,159 +18,30 @@
*/
package org.apache.syncope.core.persistence.jpa.entity.policy;
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
+import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToOne;
import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.jpa.entity.authentication.JPAAuthenticationPreProcessor;
@Entity
@Table(name = JPAAuthenticationPolicy.TABLE)
public class JPAAuthenticationPolicy extends AbstractPolicy implements AuthenticationPolicy {
- private static final long serialVersionUID = -4190607009908888884L;
-
public static final String TABLE = "AuthenticationPolicy";
+ private static final long serialVersionUID = -4190607009908888884L;
+
@Column(unique = true, nullable = false)
private String name;
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = TABLE + "Conf",
- joinColumns =
- @JoinColumn(name = "authentication_policy_id"),
- inverseJoinColumns =
- @JoinColumn(name = "implementation_id"),
- uniqueConstraints =
- @UniqueConstraint(columnNames = { "authentication_policy_id", "implementation_id" }))
- private List<JPAImplementation> configurations = new ArrayList<>();
-
- private int maxAuthenticationAttempts;
-
- private int authenticationAttemptsInterval;
-
- private int authenticationFailureLockoutDuration;
-
- private String lockoutAttributeName;
-
- private String lockoutAttributeValue;
-
- @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy =
- "authenticationPolicy")
- private JPAAuthenticationPostProcessor authenticationPostProcessor;
-
- @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy =
- "authenticationPolicy")
- private JPAAuthenticationPreProcessor authenticationPreProcessor;
-
@Override
public String getName() {
return name;
}
@Override
- public int getMaxAuthenticationAttempts() {
- return maxAuthenticationAttempts;
- }
-
- @Override
- public int getAuthenticationAttemptsInterval() {
- return authenticationAttemptsInterval;
- }
-
- @Override
- public int getAuthenticationFailureLockoutDuration() {
- return authenticationFailureLockoutDuration;
- }
-
- @Override
- public String getLockoutAttributeName() {
- return lockoutAttributeName;
- }
-
- @Override
- public String getLockoutAttributeValue() {
- return lockoutAttributeValue;
- }
-
- @Override
- public AuthenticationPostProcessor getAuthenticationPostProcessor() {
- return authenticationPostProcessor;
- }
-
- @Override
- public AuthenticationPreProcessor getAuthenticationPreProcessor() {
- return authenticationPreProcessor;
- }
-
- @Override
- public List<? extends Implementation> getConfigurations() {
- return configurations;
- }
-
- @Override
public void setName(final String name) {
this.name = name;
}
-
- @Override
- public void setMaxAuthenticationAttempts(final int maxAuthenticationAttempts) {
- this.maxAuthenticationAttempts = maxAuthenticationAttempts;
- }
-
- @Override
- public void setAuthenticationAttemptsInterval(final int authenticationAttemptsInterval) {
- this.authenticationAttemptsInterval = authenticationAttemptsInterval;
- }
-
- @Override
- public void setAuthenticationFailureLockoutDuration(final int authenticationFailureLockoutDuration) {
- this.authenticationFailureLockoutDuration = authenticationFailureLockoutDuration;
- }
-
- @Override
- public void setLockoutAttributeName(final String lockoutAttributeName) {
- this.lockoutAttributeName = lockoutAttributeName;
- }
-
- @Override
- public void setLockoutAttributeValue(final String lockoutAttributeValue) {
- this.lockoutAttributeValue = lockoutAttributeValue;
- }
-
- @Override
- public void setAuthenticationPostProcessor(final AuthenticationPostProcessor authenticationPostProcessor) {
- checkType(authenticationPostProcessor, JPAAuthenticationPostProcessor.class);
- this.authenticationPostProcessor = (JPAAuthenticationPostProcessor) authenticationPostProcessor;
- }
-
- @Override
- public void setAuthenticationPreProcessor(final AuthenticationPreProcessor authenticationPreProcessor) {
- checkType(authenticationPreProcessor, JPAAuthenticationPreProcessor.class);
- this.authenticationPreProcessor = (JPAAuthenticationPreProcessor) authenticationPreProcessor;
- }
-
- @Override
- public boolean addConfiguration(final Implementation configuration) {
- checkType(configuration, JPAImplementation.class);
- checkImplementationType(configuration, AMImplementationType.AUTH_POLICY_CONFIGURATIONS);
- return configurations.contains((JPAImplementation) configuration)
- || configurations.add((JPAImplementation) configuration);
- }
-
}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationChainTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationChainTest.java
deleted file mode 100644
index 9ad6716..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationChainTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.inner;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.util.List;
-import java.util.UUID;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.common.lib.types.ImplementationEngine;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationChainDAO;
-import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationChain;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional("Master")
-public class AuthenticationChainTest extends AbstractTest {
-
- @Autowired
- private AuthenticationChainDAO authenticationChainDAO;
-
- @Autowired
- private ImplementationDAO implementationDAO;
-
- @Test
- public void find() {
- AuthenticationChain authenticationChain = authenticationChainDAO.find(
- "4735ce66-aa3f-416b-b810-9b2c1d25ada7");
- assertNotNull(authenticationChain);
-
- authenticationChain = authenticationChainDAO.find(UUID.randomUUID().toString());
- assertNull(authenticationChain);
- }
-
- @Test
- public void findAll() {
- List<AuthenticationChain> authenticationChains = authenticationChainDAO.findAll();
- assertNotNull(authenticationChains);
- assertEquals(1, authenticationChains.size());
- }
-
- @Test
- public void save() {
- Implementation authenticationChainRule = entityFactory.newEntity(Implementation.class);
- authenticationChainRule.setKey(UUID.randomUUID().toString());
- authenticationChainRule.setEngine(ImplementationEngine.JAVA);
- authenticationChainRule.setType(AMImplementationType.AUTH_CHAIN_RULES);
- authenticationChainRule.setBody(POJOHelper.serialize(""));
-
- int beforeCount = authenticationChainDAO.findAll().size();
-
- authenticationChainRule = implementationDAO.save(authenticationChainRule);
-
- assertNotNull(authenticationChainRule);
- assertNotNull(authenticationChainRule.getKey());
-
- AuthenticationChain authenticationChain = entityFactory.newEntity(AuthenticationChain.class);
- authenticationChain.setName("AuthenticationChainTest");
- authenticationChain.add(authenticationChainRule);
- authenticationChainDAO.save(authenticationChain);
-
- assertNotNull(authenticationChain);
- assertNotNull(authenticationChain.getKey());
-
- int afterCount = authenticationChainDAO.findAll().size();
- assertEquals(afterCount, beforeCount + 1);
- }
-
- @Test
- public void delete() {
- AuthenticationChain authenticationChain = authenticationChainDAO.find(
- "4735ce66-aa3f-416b-b810-9b2c1d25ada7");
- assertNotNull(authenticationChain);
-
- authenticationChainDAO.delete("4735ce66-aa3f-416b-b810-9b2c1d25ada7");
-
- authenticationChain = authenticationChainDAO.find("4735ce66-aa3f-416b-b810-9b2c1d25ada7");
- assertNull(authenticationChain);
- }
-
-}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationModuleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationModuleTest.java
index 8802aca..294d7c1 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationModuleTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationModuleTest.java
@@ -24,15 +24,10 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.List;
import java.util.UUID;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.common.lib.types.ImplementationEngine;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationModuleDAO;
-import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
+
+import org.apache.syncope.core.persistence.api.dao.authentication.AuthenticationModuleDAO;
import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationModule;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -43,9 +38,6 @@ public class AuthenticationModuleTest extends AbstractTest {
@Autowired
private AuthenticationModuleDAO authenticationModuleDAO;
- @Autowired
- private ImplementationDAO implementationDAO;
-
@Test
public void find() {
AuthenticationModule athAuthenticationModule = authenticationModuleDAO.find(
@@ -65,23 +57,10 @@ public class AuthenticationModuleTest extends AbstractTest {
@Test
public void save() {
- Implementation authentificationModuleConf = entityFactory.newEntity(Implementation.class);
- authentificationModuleConf.setKey(UUID.randomUUID().toString());
- authentificationModuleConf.setEngine(ImplementationEngine.JAVA);
- authentificationModuleConf.setType(AMImplementationType.AUTH_MODULE_CONFIGURATIONS);
- authentificationModuleConf.setBody(POJOHelper.serialize(""));
int beforeCount = authenticationModuleDAO.findAll().size();
-
- authentificationModuleConf = implementationDAO.save(authentificationModuleConf);
-
- assertNotNull(authentificationModuleConf);
- assertNotNull(authentificationModuleConf.getKey());
-
AuthenticationModule authenticationModule = entityFactory.newEntity(AuthenticationModule.class);
authenticationModule.setName("AuthenticationModuleTest");
- authenticationModule.setTraceLevel(TraceLevel.FAILURES);
- authenticationModule.add(authentificationModuleConf);
authenticationModuleDAO.save(authenticationModule);
assertNotNull(authenticationModule);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationPolicyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationPolicyTest.java
new file mode 100644
index 0000000..be9e0de
--- /dev/null
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationPolicyTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.syncope.core.persistence.jpa.inner;
+
+import org.apache.syncope.core.persistence.api.dao.authentication.AuthenticationPolicyDAO;
+import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
+import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.UUID;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@Transactional("Master")
+public class AuthenticationPolicyTest extends AbstractTest {
+
+ @Autowired
+ private AuthenticationPolicyDAO authenticationPolicyDAO;
+
+ @Test
+ public void find() {
+ AuthenticationPolicy authenticationPolicy = authenticationPolicyDAO.find("b912a0d4-a890-416f-9ab8-84ab077eb028");
+ assertNotNull(authenticationPolicy);
+ authenticationPolicy = authenticationPolicyDAO.find(UUID.randomUUID().toString());
+ assertNull(authenticationPolicy);
+ }
+
+ @Test
+ public void findAll() {
+ List<AuthenticationPolicy> authenticationPolicies = authenticationPolicyDAO.findAll();
+ assertNotNull(authenticationPolicies);
+ assertEquals(1, authenticationPolicies.size());
+ }
+
+ @Test
+ public void save() {
+
+ int beforeCount = authenticationPolicyDAO.findAll().size();
+ AuthenticationPolicy authenticationPolicy = entityFactory.newEntity(AuthenticationPolicy.class);
+ authenticationPolicy.setName("AuthenticationPolicyTest");
+ authenticationPolicy.setDescription("This is a sample authentication policy");
+ authenticationPolicyDAO.save(authenticationPolicy);
+
+ assertNotNull(authenticationPolicy);
+ assertNotNull(authenticationPolicy.getKey());
+
+ int afterCount = authenticationPolicyDAO.findAll().size();
+ assertEquals(afterCount, beforeCount + 1);
+ }
+
+ @Test
+ public void delete() {
+ AuthenticationPolicy authenticationPolicy = authenticationPolicyDAO.find("b912a0d4-a890-416f-9ab8-84ab077eb028");
+ assertNotNull(authenticationPolicy);
+ authenticationPolicyDAO.delete("b912a0d4-a890-416f-9ab8-84ab077eb028");
+ authenticationPolicy = authenticationPolicyDAO.find("b912a0d4-a890-416f-9ab8-84ab077eb028");
+ assertNull(authenticationPolicy);
+ }
+
+}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationProcessorTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationProcessorTest.java
deleted file mode 100644
index fdc526c..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthenticationProcessorTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.syncope.core.persistence.jpa.inner;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.util.List;
-import org.apache.syncope.common.lib.types.AMImplementationType;
-import org.apache.syncope.common.lib.types.ImplementationEngine;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationPolicyRule;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationProcessorDAO;
-import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationProcessor;
-
-@Transactional("Master")
-public class AuthenticationProcessorTest extends AbstractTest {
-
- @Autowired
- private AuthenticationProcessorDAO authenticationProcessorDAO;
-
- @Autowired
- private ImplementationDAO implementationDAO;
-
- @Test
- public void findAll() {
- List<AuthenticationProcessor> processors = authenticationProcessorDAO.findAll();
- assertNotNull(processors);
- assertFalse(processors.isEmpty());
- }
-
- @Test
- public void findByKey() {
- AuthenticationProcessor authPostProcessor =
- authenticationProcessorDAO.find("2460e430-ce67-41a5-86ed-ea0a4e78c0a3");
- assertNotNull(authPostProcessor);
-
- AuthenticationProcessor authPreProcessor =
- authenticationProcessorDAO.find("c413566e-8859-11e9-bc42-526af7764f64");
- assertNotNull(authPreProcessor);
- }
-
- @Test
- public void findByType() {
- List<AuthenticationPostProcessor> processors = authenticationProcessorDAO.
- find(AuthenticationPostProcessor.class);
- assertNotNull(processors);
- assertFalse(processors.isEmpty());
- }
-
- @Test
- public void create() {
-
- AuthenticationPostProcessor authenticationPostProcessor =
- entityFactory.newEntity(AuthenticationPostProcessor.class);
- authenticationPostProcessor.setDefaultFailureLoginURL("login/error");
- authenticationPostProcessor.setDefaultSuccessLoginURL("login");
-
- Implementation postProcessing = entityFactory.newEntity(Implementation.class);
- postProcessing.setKey("PostProcessingTest");
- postProcessing.setEngine(ImplementationEngine.JAVA);
- postProcessing.setType(AMImplementationType.AUTH_POST_PROCESSING);
- postProcessing.setBody(AuthenticationPolicyRule.class.getName());
- postProcessing = implementationDAO.save(postProcessing);
- authenticationPostProcessor.addAuthPostProcessing(postProcessing);
-
- AuthenticationPreProcessor authenticationPreProcessor =
- entityFactory.newEntity(AuthenticationPreProcessor.class);
-
- Implementation preProcessing = entityFactory.newEntity(Implementation.class);
- preProcessing.setKey("PreProcessingTest");
- preProcessing.setEngine(ImplementationEngine.JAVA);
- preProcessing.setType(AMImplementationType.AUTH_PRE_PROCESSING);
- preProcessing.setBody(AuthenticationPolicyRule.class.getName());
- preProcessing = implementationDAO.save(preProcessing);
- authenticationPreProcessor.addAuthPreProcessing(preProcessing);
- }
-
- @Test
- public void update() {
- AuthenticationPostProcessor authPostProcessor =
- authenticationProcessorDAO.find("2460e430-ce67-41a5-86ed-ea0a4e78c0a3");
- assertNotNull(authPostProcessor);
- assertEquals(1, authPostProcessor.getAuthenticationPostProcessing().size());
- assertEquals("login", authPostProcessor.getDefaultSuccessLoginURL());
-
- authPostProcessor.setDefaultSuccessLoginURL("login/home");
- authPostProcessor = authenticationProcessorDAO.save(authPostProcessor);
-
- assertNotNull(authPostProcessor);
- assertEquals("login/home", authPostProcessor.getDefaultSuccessLoginURL());
- }
-
- @Test
- public void delete() {
- AuthenticationPostProcessor authPostProcessor =
- authenticationProcessorDAO.find("2460e430-ce67-41a5-86ed-ea0a4e78c0a3");
- assertNotNull(authPostProcessor);
-
- authenticationProcessorDAO.delete(authPostProcessor);
-
- authPostProcessor = authenticationProcessorDAO.find("2460e430-ce67-41a5-86ed-ea0a4e78c0a3");
- assertNull(authPostProcessor);
- }
-}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ImplementationTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ImplementationTest.java
index 533eca0..9fc9df7 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ImplementationTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ImplementationTest.java
@@ -45,7 +45,7 @@ public class ImplementationTest extends AbstractTest {
List<Implementation> implementations = implementationDAO.findAll();
assertFalse(implementations.isEmpty());
- assertEquals(23, implementations.size());
+ assertEquals(18, implementations.size());
implementations = implementationDAO.findByType(IdMImplementationType.PULL_ACTIONS);
assertEquals(1, implementations.size());
@@ -73,18 +73,6 @@ public class ImplementationTest extends AbstractTest {
implementations = implementationDAO.findByType(IdMImplementationType.PUSH_CORRELATION_RULE);
assertEquals(1, implementations.size());
-
- implementations = implementationDAO.findByType(AMImplementationType.AUTH_MODULE_CONFIGURATIONS);
- assertEquals(1, implementations.size());
-
- implementations = implementationDAO.findByType(AMImplementationType.AUTH_POLICY_CONFIGURATIONS);
- assertEquals(1, implementations.size());
-
- implementations = implementationDAO.findByType(AMImplementationType.AUTH_POST_PROCESSING);
- assertEquals(1, implementations.size());
-
- implementations = implementationDAO.findByType(AMImplementationType.AUTH_PRE_PROCESSING);
- assertEquals(1, implementations.size());
}
@Test
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
index 3b1db42..0dd95be 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
@@ -18,42 +18,35 @@
*/
package org.apache.syncope.core.persistence.jpa.inner;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.util.List;
-import java.util.UUID;
import org.apache.syncope.common.lib.policy.DefaultPasswordRuleConf;
import org.apache.syncope.common.lib.policy.DefaultPullCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.DefaultPushCorrelationRuleConf;
-import org.apache.syncope.common.lib.types.AMImplementationType;
import org.apache.syncope.common.lib.types.ConflictResolutionAction;
import org.apache.syncope.common.lib.types.IdMImplementationType;
import org.apache.syncope.common.lib.types.IdRepoImplementationType;
import org.apache.syncope.common.lib.types.ImplementationEngine;
-import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
-import org.apache.syncope.core.persistence.api.dao.AuthenticationPolicyRule;
import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.api.dao.PullCorrelationRule;
import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.PullCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
-import org.apache.syncope.core.persistence.api.dao.PullCorrelationRule;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPostProcessor;
-import org.apache.syncope.core.persistence.api.entity.authentication.AuthenticationPreProcessor;
-import org.apache.syncope.core.persistence.api.entity.policy.AuthenticationPolicy;
-import org.apache.syncope.core.persistence.api.entity.policy.PullCorrelationRuleEntity;
-import org.apache.syncope.core.persistence.api.entity.policy.PushCorrelationRuleEntity;
-import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
+
+import java.util.List;
+import java.util.UUID;
+
+import static org.junit.jupiter.api.Assertions.*;
@Transactional("Master")
public class PolicyTest extends AbstractTest {
@@ -82,7 +75,7 @@ public class PolicyTest extends AbstractTest {
PullCorrelationRuleEntity pullCR = pullPolicy.getCorrelationRule(anyTypeDAO.findUser()).orElse(null);
assertNotNull(pullCR);
DefaultPullCorrelationRuleConf pullCRConf =
- POJOHelper.deserialize(pullCR.getImplementation().getBody(), DefaultPullCorrelationRuleConf.class);
+ POJOHelper.deserialize(pullCR.getImplementation().getBody(), DefaultPullCorrelationRuleConf.class);
assertNotNull(pullCRConf);
assertEquals(2, pullCRConf.getSchemas().size());
assertTrue(pullCRConf.getSchemas().contains("username"));
@@ -94,7 +87,7 @@ public class PolicyTest extends AbstractTest {
PushCorrelationRuleEntity pushCR = pushPolicy.getCorrelationRule(anyTypeDAO.findUser()).orElse(null);
assertNotNull(pushCR);
DefaultPushCorrelationRuleConf pushCRConf =
- POJOHelper.deserialize(pushCR.getImplementation().getBody(), DefaultPushCorrelationRuleConf.class);
+ POJOHelper.deserialize(pushCR.getImplementation().getBody(), DefaultPushCorrelationRuleConf.class);
assertNotNull(pushCRConf);
assertEquals(1, pushCRConf.getSchemas().size());
assertTrue(pushCRConf.getSchemas().contains("surname"));
@@ -149,55 +142,13 @@ public class PolicyTest extends AbstractTest {
assertNotNull(policy);
assertEquals(pullURuleName,
- policy.getCorrelationRule(anyTypeDAO.findUser()).get().getImplementation().getKey());
+ policy.getCorrelationRule(anyTypeDAO.findUser()).get().getImplementation().getKey());
assertEquals(pullGRuleName,
- policy.getCorrelationRule(anyTypeDAO.findGroup()).get().getImplementation().getKey());
+ policy.getCorrelationRule(anyTypeDAO.findGroup()).get().getImplementation().getKey());
AuthenticationPolicy authenticationPolicy = entityFactory.newEntity(AuthenticationPolicy.class);
- authenticationPolicy.setAuthenticationAttemptsInterval(1);
- authenticationPolicy.setAuthenticationFailureLockoutDuration(10);
-
- AuthenticationPostProcessor authenticationPostProcessor =
- entityFactory.newEntity(AuthenticationPostProcessor.class);
- authenticationPostProcessor.setDefaultFailureLoginURL("login/error");
- authenticationPostProcessor.setDefaultSuccessLoginURL("login");
- authenticationPostProcessor.setAuthenticationPolicy(authenticationPolicy);
- Implementation postProcessing = entityFactory.newEntity(Implementation.class);
- postProcessing.setKey("PostProcessingKey");
- postProcessing.setEngine(ImplementationEngine.JAVA);
- postProcessing.setType(AMImplementationType.AUTH_POST_PROCESSING);
- postProcessing.setBody(AuthenticationPolicyRule.class.getName());
- postProcessing = implementationDAO.save(postProcessing);
- authenticationPostProcessor.addAuthPostProcessing(postProcessing);
- authenticationPolicy.setAuthenticationPostProcessor(authenticationPostProcessor);
-
- AuthenticationPreProcessor authenticationPreProcessor =
- entityFactory.newEntity(AuthenticationPreProcessor.class);
- authenticationPreProcessor.setAuthenticationPolicy(authenticationPolicy);
- Implementation preProcessing = entityFactory.newEntity(Implementation.class);
- preProcessing.setKey("PreProcessingKey");
- preProcessing.setEngine(ImplementationEngine.JAVA);
- preProcessing.setType(AMImplementationType.AUTH_PRE_PROCESSING);
- preProcessing.setBody(AuthenticationPolicyRule.class.getName());
- preProcessing = implementationDAO.save(preProcessing);
- authenticationPreProcessor.addAuthPreProcessing(preProcessing);
- authenticationPolicy.setAuthenticationPreProcessor(authenticationPreProcessor);
-
authenticationPolicy.setDescription("Syncope Account Policy");
- authenticationPolicy.setLockoutAttributeName("locked");
- authenticationPolicy.setLockoutAttributeValue("true");
- authenticationPolicy.setMaxAuthenticationAttempts(5);
-
- Implementation type = entityFactory.newEntity(Implementation.class);
- type.setKey("AuthPolicyConfKey");
- type.setEngine(ImplementationEngine.JAVA);
- type.setType(AMImplementationType.AUTH_POLICY_CONFIGURATIONS);
- type.setBody(AuthenticationPolicyRule.class.getName());
- type = implementationDAO.save(type);
-
- authenticationPolicy.addConfiguration(type);
authenticationPolicy = policyDAO.save(authenticationPolicy);
-
assertNotNull(authenticationPolicy);
}
@@ -242,15 +193,4 @@ public class PolicyTest extends AbstractTest {
Policy actual = policyDAO.find("66691e96-285f-4464-bc19-e68384ea4c85");
assertNull(actual);
}
-
- @Test
- public void deleteAuthenticationPolicy() {
- Policy policy = policyDAO.find("b912a0d4-a890-416f-9ab8-84ab077eb028");
- assertNotNull(policy);
-
- policyDAO.delete(policy);
-
- Policy actual = policyDAO.find("b912a0d4-a890-416f-9ab8-84ab077eb028");
- assertNull(actual);
- }
}
diff --git a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
index b27fd47..39020ab 100644
--- a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
@@ -44,11 +44,6 @@ under the License.
body='{"@class":"org.apache.syncope.common.lib.policy.DefaultPasswordRuleConf","maxLength":0,"minLength":10,"nonAlphanumericRequired":true,"alphanumericRequired":false,"digitRequired":true,"lowercaseRequired":true,"uppercaseRequired":true,"mustStartWithDigit":true,"mustntStartWithDigit":false,"mustEndWithDigit":true,"mustntEndWithDigit":false,"mustStartWithNonAlpha":false,"mustStartWithAlpha":false,"mustntStartWithNonAlpha":false,"mustntStartWithAlpha":false,"mustEndWit [...]
<PasswordPolicyRule policy_id="55e5de0b-c79c-4e66-adda-251b6fb8579a" implementation_id="DefaultPasswordRuleConf3"/>
- <AuthenticationPolicy id="b912a0d4-a890-416f-9ab8-84ab077eb028" name="DefaultAuthenticationPolicy"/>
- <Implementation id="DefaultAuthenticationPolicyConf" type="AUTH_POLICY_CONFIGURATIONS" engine="JAVA"
- body='{"@class":"org.apache.syncope.common.lib.authentication.DefaultAuthenticationPolicyConf","name":"DefaultAuthenticationPolicyConf"}'/>
- <AuthenticationPolicyConf authentication_policy_id="b912a0d4-a890-416f-9ab8-84ab077eb028" implementation_id="DefaultAuthenticationPolicyConf"/>
-
<RelationshipType id="inclusion" description="Models the act that an object is included in another"/>
<RelationshipType id="neighborhood" description="Models the act that an object is near another"/>
@@ -70,8 +65,7 @@ under the License.
<AnyTypeClass id="csv"/>
- <Realm id="e4c28e7a-9dbf-4ee7-9441-93812a0d4a28" name="/" passwordPolicy_id="986d1236-3ac5-4a19-810c-5ab21d79cba1"
- authenticationPolicy_id="b912a0d4-a890-416f-9ab8-84ab077eb028"/>
+ <Realm id="e4c28e7a-9dbf-4ee7-9441-93812a0d4a28" name="/" passwordPolicy_id="986d1236-3ac5-4a19-810c-5ab21d79cba1" />
<Realm id="722f3d84-9c2b-4525-8f6e-e4b82c55a36c" name="odd"
parent_id="e4c28e7a-9dbf-4ee7-9441-93812a0d4a28" accountPolicy_id="06e2ed52-6966-44aa-a177-a0ca7434201f"/>
<Realm id="c5b75db1-fce7-470f-b780-3b9934d82a9d" name="even"
@@ -2475,25 +2469,7 @@ $$ }
<SyncopeLogger logType="AUDIT" logName="syncope.audit.[LOGIC]:[AnyObjectLogic]:[]:[unlink]:[SUCCESS]" logLevel="DEBUG"/>
<SyncopeLogger logType="AUDIT" logName="syncope.audit.[LOGIC]:[AnyObjectLogic]:[]:[update]:[SUCCESS]" logLevel="DEBUG"/>
- <AuthenticationModule id="be456831-593d-4003-b273-4c3fb61700df" name="TestAuthModule"/>
- <Implementation id="DefaultAuthenticationModuleConf" type="AUTH_MODULE_CONFIGURATIONS" engine="JAVA"
- body='{"@class":"org.apache.syncope.common.lib.authentication.DefaultAuthenticationModuleConf","name":"DefaultAuthenticationModuleConf"}'/>
- <AuthenticationModuleConf authentication_module_id="be456831-593d-4003-b273-4c3fb61700df" implementation_id="DefaultAuthenticationModuleConf"/>
-
- <AuthenticationChain id="4735ce66-aa3f-416b-b810-9b2c1d25ada7" name="ChainAuthenticationPolicy"/>
- <Implementation id="ChainAuthenticationPolicyConf" type="AUTH_CHAIN_CONFIGURATIONS" engine="JAVA"
- body='{"@class":"org.apache.syncope.common.lib.authentication.ChainAuthenticationPolicyConf","name":"ChainAuthenticationPolicyConf"}'/>
- <AuthenticationChainConf authentication_chain_id="4735ce66-aa3f-416b-b810-9b2c1d25ada7" implementation_id="ChainAuthenticationPolicyConf"/>
-
- <AuthenticationPostProcessor id="2460e430-ce67-41a5-86ed-ea0a4e78c0a3" name="TestPostProcessor" authenticationPolicy_id="b912a0d4-a890-416f-9ab8-84ab077eb028"
- defaultSuccessLoginURL="login"/>
- <Implementation id="TestAuthPostProcessorAction" type="AUTH_POST_PROCESSING" engine="JAVA"
- body='{"@class":"org.apache.syncope.common.lib.authentication.TestAuthPostProcessor","name":"TestAuthPostProcessorAction"}'/>
- <AuthenticationPostProcessorActions authentication_post_processor="2460e430-ce67-41a5-86ed-ea0a4e78c0a3"
- implementation_id="TestAuthPostProcessorAction" />
-
- <AuthenticationPreProcessor id="c413566e-8859-11e9-bc42-526af7764f64" name="TestPreProcessor" authenticationPolicy_id="b912a0d4-a890-416f-9ab8-84ab077eb028"/>
- <Implementation id="TestAuthPreProcessorAction" type="AUTH_PRE_PROCESSING" engine="JAVA"
- body='{"@class":"org.apache.syncope.common.lib.authentication.TestAuthPreProcessorAction","name":"TestAuthPreProcessorAction"}'/>
- <AuthenticationPreProcessorActions authentication_pre_processor="c413566e-8859-11e9-bc42-526af7764f64" implementation_id="TestAuthPreProcessorAction"/>
+ <AuthenticationPolicy id="b912a0d4-a890-416f-9ab8-84ab077eb028" name="DefaultAuthenticationPolicy" description="Default authentication policy"/>
+ <AuthenticationModule id="be456831-593d-4003-b273-4c3fb61700df" name="DefaultAuthenticationModule"/>
+
</dataset>