directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-core git commit: FC-127 - AuthN Validator - add isAuthenticated flag as member variable
Date Fri, 11 Dec 2015 22:50:25 GMT
Repository: directory-fortress-core
Updated Branches:
  refs/heads/master 69930fe2b -> 591b068b2


 FC-127 - AuthN Validator - add isAuthenticated flag as member variable


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/591b068b
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/591b068b
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/591b068b

Branch: refs/heads/master
Commit: 591b068b273b2cd148c63339706c954d0d2968d2
Parents: 69930fe
Author: Shawn McKinney <smckinney@apache.org>
Authored: Fri Dec 11 00:10:07 2015 -0600
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Fri Dec 11 00:10:07 2015 -0600

----------------------------------------------------------------------
 .../fortress/core/util/AuthNValidator.java      | 41 ++++++++++++--------
 1 file changed, 25 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/591b068b/src/main/java/org/apache/directory/fortress/core/util/AuthNValidator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/AuthNValidator.java b/src/main/java/org/apache/directory/fortress/core/util/AuthNValidator.java
index 0b64b35..5ad8214 100644
--- a/src/main/java/org/apache/directory/fortress/core/util/AuthNValidator.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/AuthNValidator.java
@@ -34,24 +34,14 @@ import org.apache.directory.fortress.core.util.time.Validator;
 public abstract class AuthNValidator
     implements Validator
 {
-    protected String getRoleName()
-    {
-        return roleName;
-    }
-
-    protected void setRoleName(String roleName)
-    {
-        this.roleName = roleName;
-    }
-
     private String roleName;
-
-
+    private boolean isAuthenticated;
+    
     /**
      * This method is called during entity activation, {@link org.apache.directory.fortress.core.util.VUtil#validateConstraints}
and ensures the current user has been
-     * authenticated before activating the role into their session.
+     * proper authentication status before activating the role into their session.
      *
-     * This validation routine will automatically pass if session.isAuthenticated is true
and the role matches the subclasses name.
+     * This validation routine will automatically pass if session.isAuthenticated matches
the isAuthenticated member variable AND the role matches the subclasses name AND type == ROLE.
      *
      * @param session    contains the isAuthenticated flag.
      * @param constraint contains the role name.
@@ -63,11 +53,30 @@ public abstract class AuthNValidator
     public int validate(Session session, Constraint constraint, Time time, VUtil.ConstraintType
type)
     {
         int rc = 0;
-        if(type == VUtil.ConstraintType.ROLE && constraint.getName().equalsIgnoreCase(
roleName ) && !session.isAuthenticated() )
+        if(type == VUtil.ConstraintType.ROLE && constraint.getName().equalsIgnoreCase(
roleName ) && session.isAuthenticated() == isAuthenticated() )
         {
             rc = GlobalErrIds.ACTV_FAILED_AUTHN;
         }
         return rc;
     }
-}
 
+    protected String getRoleName()
+    {
+        return roleName;
+    }
+
+    protected void setRoleName(String roleName)
+    {
+        this.roleName = roleName;
+    }
+
+    protected boolean isAuthenticated()
+    {
+        return isAuthenticated;
+    }
+
+    protected void setAuthenticated(boolean isAuthenticated)
+    {
+        this.isAuthenticated = isAuthenticated;
+    }
+}
\ No newline at end of file


Mime
View raw message