geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r599857 - in /geronimo/server: branches/2.0/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/ trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/
Date Fri, 30 Nov 2007 16:18:01 GMT
Author: vamsic007
Date: Fri Nov 30 08:17:51 2007
New Revision: 599857

URL: http://svn.apache.org/viewvc?rev=599857&view=rev
Log:
GERONIMO-3658 Review RepeatedFailureLockoutLoginModule
o Changes to bring RepeatedFailureLockoutLoginModule in line with http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html

Modified:
    geronimo/server/branches/2.0/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java

Modified: geronimo/server/branches/2.0/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java?rev=599857&r1=599856&r2=599857&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
Fri Nov 30 08:17:51 2007
@@ -17,6 +17,9 @@
 package org.apache.geronimo.security.realm.providers;
 
 import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -29,6 +32,11 @@
 import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.spi.LoginModule;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
+import org.apache.geronimo.security.jaas.WrappingLoginModule;
+
 /**
  * Tracks the number of recent login failures for each user, and starts
  * rejecting login attemps if the number of failures in a certain period for a
@@ -59,9 +67,13 @@
  * @version $Rev$ $Date$
  */
 public class RepeatedFailureLockoutLoginModule implements LoginModule {
+    private static Log log = LogFactory.getLog(RepeatedFailureLockoutLoginModule.class);
+    
     public static final String FAILURE_COUNT_OPTION = "failureCount";
     public static final String FAILURE_PERIOD_OPTION = "failurePeriodSecs";
     public static final String LOCKOUT_DURATION_OPTION = "lockoutDurationSecs";
+    public final static List<String> supportedOptions = Collections.unmodifiableList(Arrays.asList(FAILURE_COUNT_OPTION,
FAILURE_PERIOD_OPTION, LOCKOUT_DURATION_OPTION));
+    
     private static final HashMap<String, LoginHistory> userData = new HashMap<String,
LoginHistory>();
     private CallbackHandler handler;
     private String username;
@@ -74,6 +86,12 @@
      */
     public void initialize(Subject subject, CallbackHandler callbackHandler,
                            Map sharedState, Map options) {
+        for(Object option: options.keySet()) {
+            if(!supportedOptions.contains(option) && !JaasLoginModuleUse.supportedOptions.contains(option)
+                    && !WrappingLoginModule.supportedOptions.contains(option)) {
+                log.warn("Ignoring option: "+option+". Not supported.");
+            }
+        }
         String fcString = (String) options.get(FAILURE_COUNT_OPTION);
         if(fcString != null) {
             fcString = fcString.trim();
@@ -159,7 +177,6 @@
      */
     public boolean logout() throws LoginException {
         username = null;
-        handler = null;
         return false;
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java?rev=599857&r1=599856&r2=599857&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/RepeatedFailureLockoutLoginModule.java
Fri Nov 30 08:17:51 2007
@@ -17,6 +17,9 @@
 package org.apache.geronimo.security.realm.providers;
 
 import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -29,6 +32,11 @@
 import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.spi.LoginModule;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
+import org.apache.geronimo.security.jaas.WrappingLoginModule;
+
 /**
  * Tracks the number of recent login failures for each user, and starts
  * rejecting login attemps if the number of failures in a certain period for a
@@ -59,9 +67,13 @@
  * @version $Rev$ $Date$
  */
 public class RepeatedFailureLockoutLoginModule implements LoginModule {
+    private static Log log = LogFactory.getLog(RepeatedFailureLockoutLoginModule.class);
+    
     public static final String FAILURE_COUNT_OPTION = "failureCount";
     public static final String FAILURE_PERIOD_OPTION = "failurePeriodSecs";
     public static final String LOCKOUT_DURATION_OPTION = "lockoutDurationSecs";
+    public final static List<String> supportedOptions = Collections.unmodifiableList(Arrays.asList(FAILURE_COUNT_OPTION,
FAILURE_PERIOD_OPTION, LOCKOUT_DURATION_OPTION));
+    
     private static final HashMap<String, LoginHistory> userData = new HashMap<String,
LoginHistory>();
     private CallbackHandler handler;
     private String username;
@@ -74,6 +86,12 @@
      */
     public void initialize(Subject subject, CallbackHandler callbackHandler,
                            Map sharedState, Map options) {
+        for(Object option: options.keySet()) {
+            if(!supportedOptions.contains(option) && !JaasLoginModuleUse.supportedOptions.contains(option)
+                    && !WrappingLoginModule.supportedOptions.contains(option)) {
+                log.warn("Ignoring option: "+option+". Not supported.");
+            }
+        }
         String fcString = (String) options.get(FAILURE_COUNT_OPTION);
         if(fcString != null) {
             fcString = fcString.trim();
@@ -159,7 +177,6 @@
      */
     public boolean logout() throws LoginException {
         username = null;
-        handler = null;
         return false;
     }
 



Mime
View raw message