syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [01/52] syncope git commit: [SYNCOPE-620] Console (JAR) in, now time for console-reference
Date Thu, 05 Feb 2015 16:00:32 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 8be42f881 -> 07aa45858


http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SyncopeLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SyncopeLogic.java
b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SyncopeLogic.java
index b706efd..6808a5b 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SyncopeLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SyncopeLogic.java
@@ -29,6 +29,7 @@ import javax.annotation.Resource;
 import org.apache.syncope.common.lib.to.SyncopeTO;
 import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
 import org.apache.syncope.server.misc.spring.ResourceWithFallbackLoader;
+import org.apache.syncope.server.persistence.api.dao.ConfDAO;
 import org.apache.syncope.server.provisioning.api.AttributableTransformer;
 import org.apache.syncope.server.provisioning.api.ConnIdBundleManager;
 import org.apache.syncope.server.provisioning.api.RoleProvisioningManager;
@@ -40,10 +41,14 @@ import org.springframework.aop.support.AopUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
 
 @Component
 public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
 
+    @Autowired
+    private ConfDAO confDAO;
+
     @Resource(name = "version")
     private String version;
 
@@ -71,11 +76,31 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
     @Resource(name = "velocityResourceLoader")
     private ResourceWithFallbackLoader resourceLoader;
 
+    @Transactional(readOnly = true)
+    public boolean isSelfRegAllowed() {
+        return confDAO.find("selfRegistration.allowed", "false").getValues().get(0).getBooleanValue();
+    }
+
+    @Transactional(readOnly = true)
+    public boolean isPwdResetAllowed() {
+        return confDAO.find("passwordReset.allowed", "false").getValues().get(0).getBooleanValue();
+    }
+
+    @Transactional(readOnly = true)
+    public boolean isPwdResetRequiringSecurityQuestions() {
+        return confDAO.find("passwordReset.securityQuestion", "true").getValues().get(0).getBooleanValue();
+    }
+
     @PreAuthorize("isAuthenticated()")
+    @Transactional(readOnly = true)
     public SyncopeTO info() {
         SyncopeTO syncopeTO = new SyncopeTO();
         syncopeTO.setVersion(version);
 
+        syncopeTO.setSelfRegAllowed(isSelfRegAllowed());
+        syncopeTO.setPwdResetAllowed(isPwdResetAllowed());
+        syncopeTO.setPwdResetRequiringSecurityQuestions(isPwdResetRequiringSecurityQuestions());
+
         if (bundleManager.getLocations() != null) {
             for (URI location : bundleManager.getLocations()) {
                 syncopeTO.getConnIdLocations().add(location.toASCIIString());

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
index c9b9249..ef869eb 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
@@ -42,7 +42,6 @@ import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.SubjectType;
 import org.apache.syncope.server.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.server.persistence.api.dao.ConfDAO;
 import org.apache.syncope.server.persistence.api.dao.NotFoundException;
 import org.apache.syncope.server.persistence.api.dao.RoleDAO;
 import org.apache.syncope.server.persistence.api.dao.SubjectSearchDAO;
@@ -81,9 +80,6 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod>
{
     protected SubjectSearchDAO searchDAO;
 
     @Autowired
-    protected ConfDAO confDAO;
-
-    @Autowired
     protected UserDataBinder binder;
 
     @Autowired
@@ -101,20 +97,8 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod>
{
     @Autowired
     protected UserProvisioningManager provisioningManager;
 
-    @Transactional(readOnly = true)
-    public boolean isSelfRegAllowed() {
-        return confDAO.find("selfRegistration.allowed", "false").getValues().get(0).getBooleanValue();
-    }
-
-    @Transactional(readOnly = true)
-    public boolean isPwdResetAllowed() {
-        return confDAO.find("passwordReset.allowed", "false").getValues().get(0).getBooleanValue();
-    }
-
-    @Transactional(readOnly = true)
-    public boolean isPwdResetRequiringSecurityQuestions() {
-        return confDAO.find("passwordReset.securityQuestion", "true").getValues().get(0).getBooleanValue();
-    }
+    @Autowired
+    protected SyncopeLogic syncopeLogic;
 
     @PreAuthorize("hasRole('USER_READ')")
     public String getUsername(final Long key) {
@@ -307,7 +291,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod>
{
             throw new NotFoundException("User " + username);
         }
 
-        if (isPwdResetRequiringSecurityQuestions()
+        if (syncopeLogic.isPwdResetRequiringSecurityQuestions()
                 && (securityAnswer == null || !securityAnswer.equals(user.getSecurityAnswer())))
{
 
             throw SyncopeClientException.build(ClientExceptionType.InvalidSecurityAnswer);

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/server/rest-cxf/src/main/java/org/apache/syncope/server/rest/cxf/service/UserSelfServiceImpl.java
----------------------------------------------------------------------
diff --git a/syncope620/server/rest-cxf/src/main/java/org/apache/syncope/server/rest/cxf/service/UserSelfServiceImpl.java
b/syncope620/server/rest-cxf/src/main/java/org/apache/syncope/server/rest/cxf/service/UserSelfServiceImpl.java
index c018d5c..826c312 100644
--- a/syncope620/server/rest-cxf/src/main/java/org/apache/syncope/server/rest/cxf/service/UserSelfServiceImpl.java
+++ b/syncope620/server/rest-cxf/src/main/java/org/apache/syncope/server/rest/cxf/service/UserSelfServiceImpl.java
@@ -18,14 +18,13 @@
  */
 package org.apache.syncope.server.rest.cxf.service;
 
-import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.mod.UserMod;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
+import org.apache.syncope.server.logic.SyncopeLogic;
 import org.apache.syncope.server.logic.UserLogic;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -36,18 +35,12 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements
UserSelf
     @Autowired
     private UserLogic logic;
 
-    @Override
-    public Response getOptions() {
-        return Response.ok().header(HttpHeaders.ALLOW, OPTIONS_ALLOW).
-                header(RESTHeaders.SELFREG_ALLOWED, logic.isSelfRegAllowed()).
-                header(RESTHeaders.PWDRESET_ALLOWED, logic.isPwdResetAllowed()).
-                header(RESTHeaders.PWDRESET_NEEDS_SECURITYQUESTIONS, logic.isPwdResetRequiringSecurityQuestions()).
-                build();
-    }
+    @Autowired
+    private SyncopeLogic syncopeLogic;
 
     @Override
     public Response create(final UserTO userTO, final boolean storePassword) {
-        if (!logic.isSelfRegAllowed()) {
+        if (!syncopeLogic.isSelfRegAllowed()) {
             SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unauthorized);
             sce.getElements().add("Self registration forbidden by configuration");
             throw sce;
@@ -77,7 +70,7 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements
UserSelf
 
     @Override
     public void requestPasswordReset(final String username, final String securityAnswer)
{
-        if (!logic.isPwdResetAllowed()) {
+        if (!syncopeLogic.isPwdResetAllowed()) {
             SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unauthorized);
             sce.getElements().add("Password reset forbidden by configuration");
             throw sce;
@@ -88,7 +81,7 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements
UserSelf
 
     @Override
     public void confirmPasswordReset(final String token, final String password) {
-        if (!logic.isPwdResetAllowed()) {
+        if (!syncopeLogic.isPwdResetAllowed()) {
             SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unauthorized);
             sce.getElements().add("Password reset forbidden by configuration");
             throw sce;

http://git-wip-us.apache.org/repos/asf/syncope/blob/32707b3b/syncope620/server/rest-cxf/src/main/resources/META-INF/org.apache.cxf.Logger
----------------------------------------------------------------------
diff --git a/syncope620/server/rest-cxf/src/main/resources/META-INF/org.apache.cxf.Logger
b/syncope620/server/rest-cxf/src/main/resources/META-INF/org.apache.cxf.Logger
deleted file mode 100644
index 6e7bd36..0000000
--- a/syncope620/server/rest-cxf/src/main/resources/META-INF/org.apache.cxf.Logger
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.cxf.common.logging.Slf4jLogger


Mime
View raw message