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/03/26 07:09:36 UTC
[syncope] 02/04: merge with master
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 dd74a8075306b3adb51a8de9ff815f67e10a0a77
Merge: 5b3cd4f 7691e4c
Author: Misagh Moayyed <mm...@gmail.com>
AuthorDate: Wed Mar 25 18:49:19 2020 +0430
merge with master
.../module => auth}/AbstractAuthModuleConf.java | 8 +-
.../module => auth}/AuthModuleConf.java | 6 +-
.../module => auth}/GoogleMfaAuthModuleConf.java | 2 +-
.../module => auth}/JaasAuthModuleConf.java | 2 +-
.../module => auth}/LDAPAuthModuleConf.java | 2 +-
.../module => auth}/OIDCAuthModuleConf.java | 2 +-
.../module => auth}/SAML2IdPAuthModuleConf.java | 2 +-
.../module => auth}/StaticAuthModuleConf.java | 2 +-
.../package-info.java} | 21 +-
.../AbstractAccessPolicyConf.java | 2 +-
.../AbstractAttrReleasePolicyConf.java | 2 +-
.../policy/AbstractAuthPolicyConf.java | 2 +-
.../policy/AbstractAuthPolicyCriteriaConf.java | 2 +-
.../lib/{access => policy}/AccessPolicyConf.java | 2 +-
.../AllowedAttrReleasePolicyConf.java | 2 +-
.../{attrs => policy}/AttrReleasePolicyConf.java | 2 +-
.../policy/AuthPolicyConf.java | 2 +-
.../policy/AuthPolicyCriteriaConf.java | 2 +-
.../DefaultAccessPolicyConf.java | 2 +-
.../policy/DefaultAuthPolicyConf.java | 3 +-
.../policy/DefaultAuthPolicyCriteriaConf.java | 2 +-
.../package-info.java} | 21 +-
.../syncope/common/lib/to/client/ClientAppTO.java | 4 +-
.../{OIDCRelyingPartyTO.java => OIDCRPTO.java} | 8 +-
...{SAML2ServiceProviderTO.java => SAML2SPTO.java} | 16 +-
.../syncope/common/lib/types/AMEntitlement.java | 28 +--
.../common/lib/types/AMImplementationType.java | 9 +-
.../ClientAppType.java} | 9 +-
...rviceProviderNameId.java => SAML2SPNameId.java} | 5 +-
.../common/rest/api/service/ClientAppService.java | 65 ++---
.../org/apache/syncope/common/lib/to/AnyTO.java | 3 -
.../common/lib/types/IdRepoImplementationType.java | 2 +-
.../syncope/common/lib/types/PolicyType.java | 2 +-
.../apache/syncope/core/logic/ClientAppLogic.java | 204 ++++++++++++++++
.../init/ClassPathScanImplementationLookup.java | 6 +-
.../core/logic/oidc/OIDCRelyingPartyLogic.java | 101 --------
.../core/logic/saml/SAML2ServiceProviderLogic.java | 98 --------
.../rest/cxf/service/ClientAppServiceImpl.java | 68 ++----
.../org/apache/syncope/core/logic/PolicyLogic.java | 3 +
.../syncope/core/logic/cocoon/FopSerializer.java | 26 +-
.../syncope/core/logic/cocoon/TextSerializer.java | 2 +-
.../syncope/core/logic/cocoon/XSLTTransformer.java | 26 +-
.../{authentication => auth}/AuthModuleDAO.java | 4 +-
.../OIDCRPDAO.java} | 19 +-
.../SAML2SPDAO.java} | 19 +-
.../{authentication => auth}/AuthModule.java | 2 +-
.../entity/{authentication => auth}/ClientApp.java | 2 +-
.../api/entity/auth/ClientAppUtils.java | 12 +-
.../ClientAppUtilsFactory.java} | 17 +-
.../OIDCRelyingParty.java => auth/OIDCRP.java} | 8 +-
.../SAML2SP.java} | 14 +-
.../src/test/resources/domains/MasterContent.xml | 24 +-
.../core/persistence/jpa/dao/AbstractDAO.java | 5 +-
.../core/persistence/jpa/dao/JPAPolicyDAO.java | 9 +-
.../{authentication => auth}/JPAAuthModuleDAO.java | 8 +-
.../JPAOIDCRPDAO.java} | 61 +++--
.../persistence/jpa/dao/auth/JPASAML2SPDAO.java | 108 +++++++++
.../jpa/dao/authentication/JPASAML2SPDAO.java | 110 ---------
.../persistence/jpa/entity/JPAEntityFactory.java | 22 +-
.../core/persistence/jpa/entity/JPARealm.java | 42 ++--
.../AbstractClientApp.java | 4 +-
.../{authentication => auth}/JPAAuthModule.java | 4 +-
.../jpa/entity/auth/JPAClientAppUtils.java | 51 ++++
.../jpa/entity/auth/JPAClientAppUtilsFactory.java | 72 ++++++
.../JPAOIDCRP.java} | 21 +-
.../JPASAML2SP.java} | 18 +-
.../jpa/entity/policy/JPAPolicyUtils.java | 5 +-
.../jpa/entity/policy/JPAPolicyUtilsFactory.java | 4 +-
.../jpa/inner/AbstractClientAppTest.java | 6 +-
.../core/persistence/jpa/inner/AuthModuleTest.java | 37 ++-
.../{OIDCRelyingPartyTest.java => OIDCRPTest.java} | 34 ++-
.../core/persistence/jpa/inner/PolicyTest.java | 8 +-
...L2ServiceProviderTest.java => SAML2SPTest.java} | 38 ++-
.../core/persistence/jpa/outer/PolicyTest.java | 11 +-
.../src/test/resources/domains/MasterContent.xml | 26 +-
...rtyDataBinder.java => ClientAppDataBinder.java} | 12 +-
.../api/data/SAML2ServiceProviderDataBinder.java | 31 ---
.../java/data/ClientAppDataBinderImpl.java | 264 +++++++++++++++++++++
.../java/data/ImplementationDataBinderImpl.java | 10 +-
.../java/data/OIDCRelyingPartyDataBinderImpl.java | 141 -----------
.../data/SAML2ServiceProviderDataBinderImpl.java | 150 ------------
.../org/apache/syncope/fit/AbstractITCase.java | 24 --
.../apache/syncope/fit/core/ClientAppITCase.java | 229 ++++++++++++++++++
.../syncope/fit/core/OIDCRelyingPartyITCase.java | 124 ----------
.../org/apache/syncope/fit/core/PolicyITCase.java | 24 +-
.../org/apache/syncope/fit/core/RealmITCase.java | 10 +-
.../fit/core/SAML2ServiceProviderITCase.java | 125 ----------
fit/wa-reference/src/main/resources/wa.properties | 8 +
pom.xml | 11 +-
wa/bootstrap/pom.xml | 2 +
.../java/org/apache/syncope/wa/WARestClient.java | 16 +-
.../bootstrap/SyncopeWABootstrapConfiguration.java | 4 +-
.../bootstrap/SyncopeWAPropertySourceLocator.java | 44 +---
.../syncope/wa/starter/SyncopeWAConfiguration.java | 14 +-
.../wa/starter/rest/SyncopeServiceRegistry.java | 18 +-
wa/starter/src/main/resources/wa.properties | 2 -
96 files changed, 1401 insertions(+), 1465 deletions(-)
diff --cc wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/SyncopeWABootstrapConfiguration.java
index c583f79,fb7732b..e9fdfa9
--- a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/SyncopeWABootstrapConfiguration.java
+++ b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/SyncopeWABootstrapConfiguration.java
@@@ -22,8 -24,8 +22,6 @@@ import org.apache.syncope.common.keymas
import org.apache.syncope.common.keymaster.client.self.SelfKeymasterClientContext;
import org.apache.syncope.common.keymaster.client.zookeper.ZookeeperKeymasterClientContext;
import org.apache.syncope.wa.WARestClient;
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@@@ -31,13 -33,15 +29,13 @@@ import org.springframework.cloud.bootst
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
-import org.springframework.core.env.MapPropertySource;
@Configuration(proxyBeanMethods = false)
-@ImportAutoConfiguration(classes = { ZookeeperKeymasterClientContext.class, SelfKeymasterClientContext.class })
+@ImportAutoConfiguration(classes = {ZookeeperKeymasterClientContext.class, SelfKeymasterClientContext.class})
@PropertySource("classpath:wa.properties")
@PropertySource(value = "file:${conf.directory}/wa.properties", ignoreResourceNotFound = true)
-public class RestfulCloudConfigBootstrapConfiguration {
+public class SyncopeWABootstrapConfiguration {
- private static final Logger LOG = LoggerFactory.getLogger(SyncopeWABootstrapConfiguration.class);
+
- private static final Logger LOG = LoggerFactory.getLogger(RestfulCloudConfigBootstrapConfiguration.class);
@Value("${anonymousUser}")
private String anonymousUser;
diff --cc wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/SyncopeWAPropertySourceLocator.java
index 78f7633,0000000..c60284e
mode 100644,000000..100644
--- a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/SyncopeWAPropertySourceLocator.java
+++ b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/SyncopeWAPropertySourceLocator.java
@@@ -1,89 -1,0 +1,51 @@@
+/*
+ * 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.wa.bootstrap;
+
- import org.apereo.cas.configuration.CasConfigurationProperties;
- import org.apereo.cas.configuration.CasCoreConfigurationUtils;
-
- import org.apache.syncope.common.lib.authentication.module.StaticAuthModuleConf;
- import org.apache.syncope.common.lib.authentication.policy.AuthPolicyConf;
- import org.apache.syncope.common.lib.policy.PolicyTO;
- import org.apache.syncope.common.lib.to.AuthPolicyTO;
- import org.apache.syncope.common.lib.to.ImplementationTO;
- import org.apache.syncope.common.lib.types.AMImplementationType;
- import org.apache.syncope.common.lib.types.PolicyType;
- import org.apache.syncope.common.rest.api.service.ImplementationService;
- import org.apache.syncope.common.rest.api.service.PolicyService;
- import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
+import org.apache.syncope.wa.WARestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.bootstrap.config.PropertySourceLocator;
+import org.springframework.core.annotation.Order;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.PropertySource;
+
- import java.util.List;
- import java.util.Map;
++import java.util.HashMap;
+
+@Order
+public class SyncopeWAPropertySourceLocator implements PropertySourceLocator {
+ private static final Logger LOG = LoggerFactory.getLogger(SyncopeWABootstrapConfiguration.class);
+
- private final PolicyService policyService;
-
- private final ImplementationService implementationService;
+
+ public SyncopeWAPropertySourceLocator(final WARestClient waRestClient) {
- this.policyService = waRestClient.getSyncopeClient().getService(PolicyService.class);
- this.implementationService = waRestClient.getSyncopeClient().getService(ImplementationService.class);
++
+ }
+
+ @Override
+ public PropertySource<?> locate(final Environment environment) {
+ try {
+ LOG.info("Bootstrapping WA configuration");
- List<PolicyTO> policies = policyService.list(PolicyType.AUTHENTICATION);
- CasConfigurationProperties cas = new CasConfigurationProperties();
- policies.
- stream().
- map(AuthPolicyTO.class::cast).
- forEach(policy -> translatePolicy(policy, cas));
- Map<String, Object> payload = CasCoreConfigurationUtils.asMap(cas.withHolder());
- return new MapPropertySource(getClass().getName(), payload);
++ return new MapPropertySource(getClass().getName(), new HashMap<>());
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Unable to fetch settings", e);
+ }
+ }
-
- private void translatePolicy(final AuthPolicyTO policy, final CasConfigurationProperties cas) {
- ImplementationTO implTO = implementationService.
- read(AMImplementationType.AUTH_POLICY_CONFIGURATIONS, policy.getKey());
- AuthPolicyConf policyConf = POJOHelper.deserialize(implTO.getBody(), AuthPolicyConf.class);
- if (policyConf instanceof StaticAuthModuleConf) {
- StaticAuthModuleConf staticConf = (StaticAuthModuleConf) policyConf;
- StringBuilder users = new StringBuilder();
- staticConf.getUsers().forEach((key, value) -> users.append(key).append("::").append(value));
- cas.getAuthn().getAccept().setName(policyConf.getName());
- cas.getAuthn().getAccept().setUsers(users.toString());
- }
- }
+}