syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [05/31] syncope git commit: [SYNCOPE-1012] Just a case problem
Date Thu, 23 Feb 2017 13:13:21 GMT
[SYNCOPE-1012] Just a case problem


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4c4d3bae
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4c4d3bae
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4c4d3bae

Branch: refs/heads/SYNCOPE-808
Commit: 4c4d3baefbb10da1e28391f38de0793e090a12ee
Parents: b8aa792
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Sun Feb 12 09:06:05 2017 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Sun Feb 12 09:06:05 2017 +0100

----------------------------------------------------------------------
 .../client/enduser/resources/InfoResource.java  |  4 ---
 .../enduser/resources/LogoutResource.java       |  8 ++----
 .../resources/SecurityQuestionResource.java     |  5 ----
 .../resources/UserSelfChangePassword.java       |  5 ----
 .../resources/UserSelfConfirmPasswordReset.java |  5 ----
 .../resources/UserSelfCreateResource.java       | 16 ++++-------
 .../resources/UserSelfPasswordReset.java        | 30 +++++++++-----------
 .../enduser/resources/UserSelfReadResource.java |  1 -
 8 files changed, 21 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
index 1af9593..d6eab9a 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
@@ -28,13 +28,9 @@ import org.apache.syncope.client.enduser.util.SaltGenerator;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.wicket.request.resource.IResource;
 import org.apache.wicket.util.cookies.CookieUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class InfoResource extends AbstractBaseResource {
 
-    private static final Logger LOG = LoggerFactory.getLogger(InfoResource.class);
-
     private static final long serialVersionUID = 6453101466981543020L;
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
index 3101332..4f20d60 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
@@ -19,22 +19,18 @@
 package org.apache.syncope.client.enduser.resources;
 
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class LogoutResource extends AbstractBaseResource {
 
     private static final long serialVersionUID = -648841355644985051L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(LogoutResource.class);
-
     @Override
     protected ResourceResponse newResourceResponse(final Attributes attributes) {
 
         LOG.debug("Logout from enduser application");
-        
+
         SyncopeEnduserSession.get().invalidate();
-        
+
         ResourceResponse response = new ResourceResponse();
         response.setStatusCode(204);
         return response;

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
index 160c30e..d812f72 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
@@ -31,13 +31,9 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
 import org.apache.wicket.util.string.StringValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class SecurityQuestionResource extends AbstractBaseResource {
 
-    private static final Logger LOG = LoggerFactory.getLogger(SecurityQuestionResource.class);
-
     private static final long serialVersionUID = 6453101466981543020L;
 
     private final SecurityQuestionService securityQuestionService;
@@ -48,7 +44,6 @@ public class SecurityQuestionResource extends AbstractBaseResource {
 
     @Override
     protected AbstractResource.ResourceResponse newResourceResponse(final IResource.Attributes
attributes) {
-
         LOG.debug("List available security questions");
 
         AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
index 90ffdcd..b4ed2a2 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
@@ -27,15 +27,11 @@ import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UserSelfChangePassword extends AbstractBaseResource {
 
     private static final long serialVersionUID = -2721621682300247583L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(UserSelfChangePassword.class);
-
     private final UserSelfService userSelfService;
 
     public UserSelfChangePassword() {
@@ -44,7 +40,6 @@ public class UserSelfChangePassword extends AbstractBaseResource {
 
     @Override
     protected ResourceResponse newResourceResponse(final IResource.Attributes attributes)
{
-
         AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();
 
         try {

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
index c7a3a55..da36e47 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
@@ -27,15 +27,11 @@ import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UserSelfConfirmPasswordReset extends AbstractBaseResource {
 
     private static final long serialVersionUID = -2721621682300247583L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(UserSelfConfirmPasswordReset.class);
-
     private final UserSelfService userSelfService;
 
     public UserSelfConfirmPasswordReset() {
@@ -44,7 +40,6 @@ public class UserSelfConfirmPasswordReset extends AbstractBaseResource {
 
     @Override
     protected ResourceResponse newResourceResponse(final IResource.Attributes attributes)
{
-
         AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();
 
         try {

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
index fd65e93..4476989 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
@@ -38,15 +38,11 @@ import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UserSelfCreateResource extends AbstractBaseResource {
 
     private static final long serialVersionUID = -2721621682300247583L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(UserSelfCreateResource.class);
-
     private final UserSelfService userSelfService;
 
     public UserSelfCreateResource() {
@@ -190,9 +186,9 @@ public class UserSelfCreateResource extends AbstractBaseResource {
                         attributes.getResponse().write(res.getStatusInfo().getFamily().equals(
                                 Response.Status.Family.SUCCESSFUL)
                                         ? responseMessage.append("User: ").append(userTO.getUsername()).append(
-                                        " successfully created")
+                                                " successfully created")
                                         : new StringBuilder().append("ErrorMessage{{ ").
-                                        append(res.getStatusInfo().getReasonPhrase()).append("
}}"));
+                                                append(res.getStatusInfo().getReasonPhrase()).append("
}}"));
                     }
                 });
                 response.setStatusCode(res.getStatus());
@@ -207,10 +203,10 @@ public class UserSelfCreateResource extends AbstractBaseResource {
             LOG.error("Could not create userTO", e);
             response.setError(Response.Status.BAD_REQUEST.getStatusCode(),
                     new StringBuilder().
-                    append("ErrorMessage{{ ").
-                    append(e.getMessage()).
-                    append(" }}").
-                    toString());
+                            append("ErrorMessage{{ ").
+                            append(e.getMessage()).
+                            append(" }}").
+                            toString());
         }
         return response;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
index 8b36c69..a173672 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
@@ -22,21 +22,18 @@ import java.io.IOException;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UserSelfPasswordReset extends AbstractBaseResource {
 
     private static final long serialVersionUID = -2721621682300247583L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(UserSelfPasswordReset.class);
-
     private final UserSelfService userSelfService;
 
     public UserSelfPasswordReset() {
@@ -56,11 +53,9 @@ public class UserSelfPasswordReset extends AbstractBaseResource {
             }
 
             Map<String, String[]> parameters = request.getParameterMap();
-            String username;
-            if (parameters.get("username") == null || parameters.get("username").length ==
0) {
+            String[] usernameParam = parameters.get("username");
+            if (ArrayUtils.isEmpty(usernameParam)) {
                 throw new Exception("A valid username should be provided");
-            } else {
-                username = parameters.get("username")[0];
             }
 
             if (request.getHeader("captcha") == null
@@ -72,15 +67,16 @@ public class UserSelfPasswordReset extends AbstractBaseResource {
             }
 
             if (SyncopeEnduserSession.get().getPlatformInfo().isPwdResetRequiringSecurityQuestions())
{
-                if (parameters.get("securityanswer") == null || parameters.get("securityanswer").length
== 0) {
+                String[] securityAnswerParam = parameters.get("securityAnswer");
+                if (ArrayUtils.isEmpty(securityAnswerParam)) {
                     throw new Exception("A correct security answer should be provided");
                 }
-                userSelfService.requestPasswordReset(username, parameters.get("securityanswer")[0]);
+                userSelfService.requestPasswordReset(usernameParam[0], securityAnswerParam[0]);
             } else {
-                userSelfService.requestPasswordReset(username, null);
+                userSelfService.requestPasswordReset(usernameParam[0], null);
             }
-            final String responseMessage = new StringBuilder().append("Password reset request
sent for user ").append(
-                    username).toString();
+            final String responseMessage = new StringBuilder().
+                    append("Password reset request sent for user ").append(usernameParam[0]).toString();
 
             response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new WriteCallback() {
@@ -97,10 +93,10 @@ public class UserSelfPasswordReset extends AbstractBaseResource {
             LOG.error("Error while updating user", e);
             response.setError(Response.Status.BAD_REQUEST.getStatusCode(),
                     new StringBuilder().
-                    append("ErrorMessage{{ ").
-                    append(e.getMessage()).
-                    append(" }}").
-                    toString());
+                            append("ErrorMessage{{ ").
+                            append(e.getMessage()).
+                            append(" }}").
+                            toString());
         }
         return response;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4c4d3bae/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
index a0342b1..a145557 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -42,7 +42,6 @@ public class UserSelfReadResource extends AbstractBaseResource {
 
     @Override
     protected ResourceResponse newResourceResponse(final IResource.Attributes attributes)
{
-
         LOG.debug("Requested user self information");
 
         AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();


Mime
View raw message