portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r376818 - /portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/DefaultLoginModule.java
Date Fri, 10 Feb 2006 19:49:07 GMT
Author: taylor
Date: Fri Feb 10 11:49:05 2006
New Revision: 376818

URL: http://svn.apache.org/viewcvs?rev=376818&view=rev
Log:
lazy load Login Module
In some app servers the module's default constructor is called instead of our preferred constructor
via Spring. This attempts to resolve Spring dependencies at a later time than at construction

Modified:
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/DefaultLoginModule.java

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/DefaultLoginModule.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/DefaultLoginModule.java?rev=376818&r1=376817&r2=376818&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/DefaultLoginModule.java
(original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/DefaultLoginModule.java
Fri Feb 10 11:49:05 2006
@@ -78,24 +78,30 @@
     /** <p>The user name.</p> */
     private String username;
 
+    
     /**
      * <p>The default login module constructor.</p>
      */
     public DefaultLoginModule()
     {
         LoginModuleProxy loginModuleProxy = LoginModuleProxyImpl.loginModuleProxy;
-        this.ums = loginModuleProxy.getUserManager();
+        if (loginModuleProxy != null)
+        {
+            this.ums = loginModuleProxy.getUserManager();
+        }
         debug = false;
         success = false;
         commitSuccess = false;
         username = null;
     }
 
+    
     /**
      * Create a new login module that uses the given user manager.
      * @param userManager the user manager to use
      */
-    protected DefaultLoginModule (UserManager userManager) {
+    protected DefaultLoginModule (UserManager userManager) 
+    {
         ums = userManager;
         debug = false;
         success = false;
@@ -120,6 +126,18 @@
         return true;
     }
 
+    protected void refreshProxy()
+    {
+        if (this.ums == null)
+        {
+            LoginModuleProxy loginModuleProxy = LoginModuleProxyImpl.loginModuleProxy;
+            if (loginModuleProxy != null)
+            {
+                this.ums = loginModuleProxy.getUserManager();
+            }
+        }        
+    }
+    
     /**
      * @see javax.security.auth.spi.LoginModule#commit()
      */
@@ -135,6 +153,7 @@
             {
                 // TODO We should get the user profile here and had it in cache so that we
do not have to retrieve it again.
                 // TODO Ideally the User should be available from the session.  Need discussion
around this.
+                refreshProxy();
                 commitPrincipals(subject, ums.getUser(username));
 
                 username = null;
@@ -177,6 +196,7 @@
 
             ((PasswordCallback) callbacks[1]).clearPassword();
 
+            refreshProxy();            
             success = ums.authenticate(this.username, password);
 
             callbacks[0] = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message