syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/2] syncope git commit: [SYNCOPE-767] Applying suggested improvement
Date Tue, 16 Feb 2016 09:30:12 GMT
[SYNCOPE-767] Applying suggested improvement


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

Branch: refs/heads/1_2_X
Commit: a8310e8782794580352ae181ba005c4fa34ecd5a
Parents: 16e2193
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Tue Feb 16 10:30:04 2016 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Tue Feb 16 10:30:04 2016 +0100

----------------------------------------------------------------------
 .../apache/syncope/core/policy/AccountPolicyEnforcer.java    | 7 ++-----
 .../apache/syncope/core/policy/PasswordPolicyEnforcer.java   | 8 ++------
 2 files changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/a8310e87/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
b/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
index ae051fa..bb9461f 100644
--- a/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
+++ b/core/src/main/java/org/apache/syncope/core/policy/AccountPolicyEnforcer.java
@@ -19,7 +19,7 @@
 package org.apache.syncope.core.policy;
 
 import java.util.regex.Pattern;
-
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.types.AccountPolicySpec;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -34,9 +34,6 @@ public class AccountPolicyEnforcer extends PolicyEnforcer<AccountPolicySpec,
Syn
     @Autowired(required = false)
     private UserSuspender userSuspender;
 
-    /* (non-Javadoc)
-     * @see AccountPolicyEnforcer#enforce(AccountPolicySpec, PolicyType, SyncopeUser)
-     */
     @Override
     public void enforce(final AccountPolicySpec policy, final PolicyType type, final SyncopeUser
user)
             throws AccountPolicyException, PolicyEnforceException {
@@ -61,7 +58,7 @@ public class AccountPolicyEnforcer extends PolicyEnforcer<AccountPolicySpec,
Syn
 
         // check words not permitted
         for (String word : policy.getWordsNotPermitted()) {
-            if (user.getUsername().contains(word)) {
+            if (StringUtils.containsIgnoreCase(user.getUsername(), word)) {
                 throw new AccountPolicyException("Used word(s) not permitted");
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/a8310e87/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
b/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
index 2b6554d..64e02af 100644
--- a/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
+++ b/core/src/main/java/org/apache/syncope/core/policy/PasswordPolicyEnforcer.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.policy;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.types.PasswordPolicySpec;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -26,11 +27,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class PasswordPolicyEnforcer extends PolicyEnforcer<PasswordPolicySpec, SyncopeUser>
{
 
-    /* (non-Javadoc)
-     * @see
-     * org.apache.syncope.core.policy.PasswordPolicyEnforcer#enforce(org.apache.syncope.common.types.PasswordPolicySpec,
-     * org.apache.syncope.common.types.PolicyType, java.lang.String)
-     */
     @Override
     public void enforce(final PasswordPolicySpec policy, final PolicyType type, final SyncopeUser
user)
             throws PasswordPolicyException, PolicyEnforceException {
@@ -56,7 +52,7 @@ public class PasswordPolicyEnforcer extends PolicyEnforcer<PasswordPolicySpec,
S
 
             // check words not permitted
             for (String word : policy.getWordsNotPermitted()) {
-                if (clearPassword.contains(word)) {
+                if (StringUtils.containsIgnoreCase(clearPassword, word)) {
                     throw new PasswordPolicyException("Used word(s) not permitted");
                 }
             }


Mime
View raw message