geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r472291 - in /geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas: client/JaasLoginCoordinator.java client/ServerLoginProxy.java server/JaasLoginService.java server/JaasLoginServiceMBean.java
Date Tue, 07 Nov 2006 21:51:35 GMT
Author: vamsic007
Date: Tue Nov  7 13:51:35 2006
New Revision: 472291

URL: http://svn.apache.org/viewvc?view=rev&rev=472291
Log:
GERONIMO-2294 In security realm with multiple login modules, anything after the first is ignored/GERONIMO-2268
Security Realm with more than one LoginModule does not function as expected

Modified:
    geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/JaasLoginCoordinator.java
    geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/ServerLoginProxy.java
    geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
    geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java

Modified: geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/JaasLoginCoordinator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/JaasLoginCoordinator.java?view=diff&rev=472291&r1=472290&r2=472291
==============================================================================
--- geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/JaasLoginCoordinator.java
(original)
+++ geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/JaasLoginCoordinator.java
Tue Nov  7 13:51:35 2006
@@ -23,6 +23,7 @@
 import javax.management.ObjectName;
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 
@@ -117,7 +118,13 @@
             proxies[i].initialize(subject, handler, sharedState, config[i].getOptions());
             syncSharedState();
         }
-        return performLogin();
+        boolean result = performLogin();
+        if(result) {
+            return true;
+        } else {
+            // login() method should throw LoginException incase of failure
+            throw new FailedLoginException();
+        }
     }
 
     public boolean commit() throws LoginException {
@@ -196,7 +203,12 @@
 
         for (int i = 0; i < proxies.length; i++) {
             LoginModuleProxy proxy = proxies[i];
-            boolean result = proxy.login();
+            boolean result;
+            try {
+                result = proxy.login();
+            } catch(LoginException e) {
+                result = false;  // login() method throws LoginException incase of failure
+            }
             syncSharedState();
 
             if (proxy.getControlFlag() == LoginModuleControlFlag.REQUIRED) {

Modified: geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/ServerLoginProxy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/ServerLoginProxy.java?view=diff&rev=472291&r1=472290&r2=472291
==============================================================================
--- geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/ServerLoginProxy.java
(original)
+++ geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/client/ServerLoginProxy.java
Tue Nov  7 13:51:35 2006
@@ -86,7 +86,7 @@
     }
 
     public boolean abort() throws LoginException {
-        return false; // taken care of with a single call to the server
+        return service.performAbort(sessionHandle, lmIndex);
     }
 
     public boolean logout() throws LoginException {

Modified: geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java?view=diff&rev=472291&r1=472290&r2=472291
==============================================================================
--- geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
(original)
+++ geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
Tue Nov  7 13:51:35 2006
@@ -257,6 +257,16 @@
     }
 
     /**
+     * Indicates that the overall login failed.  This method needs to be called
+     * once for each client-side login module.
+     */
+    public boolean performAbort(JaasSessionId sessionHandle, int loginModuleIndex) throws
LoginException {
+        JaasSecuritySession session = (JaasSecuritySession) activeLogins.get(sessionHandle);
+        checkContext(session, loginModuleIndex);
+        return session.getLoginModule(loginModuleIndex).abort();
+    }
+
+    /**
      * Indicates that the overall login succeeded.  All login modules that were
      * touched should have been logged in and committed before calling this.
      */

Modified: geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java?view=diff&rev=472291&r1=472290&r2=472291
==============================================================================
--- geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/server/JaasLoginServiceMBean.java
Tue Nov  7 13:51:35 2006
@@ -118,4 +118,10 @@
      * @return the sync'd set of principals that are on the server
      */
     public Set syncPrincipals(JaasSessionId sessionHandle, Set principals) throws LoginException;
+
+    /**
+     * Indicates that the overall login failed.  This method needs to be called
+     * once for each client-side login module.
+     */
+    public boolean performAbort(JaasSessionId sessionHandle, int lmIndex) throws LoginException;
 }



Mime
View raw message