geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r291324 - /geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/realm/TomcatGeronimoRealm.java
Date Sat, 24 Sep 2005 16:50:27 GMT
Author: djencks
Date: Sat Sep 24 09:50:23 2005
New Revision: 291324

URL: http://svn.apache.org/viewcvs?rev=291324&view=rev
Log:
avoid NPE when no password is given

Modified:
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/realm/TomcatGeronimoRealm.java

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/realm/TomcatGeronimoRealm.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/realm/TomcatGeronimoRealm.java?rev=291324&r1=291323&r2=291324&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/realm/TomcatGeronimoRealm.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/realm/TomcatGeronimoRealm.java
Sat Sep 24 09:50:23 2005
@@ -21,7 +21,6 @@
 import java.security.AccessControlException;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
-
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.AccountExpiredException;
@@ -42,15 +41,13 @@
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.deploy.LoginConfig;
 import org.apache.catalina.deploy.SecurityConstraint;
-import org.apache.catalina.realm.JAASCallbackHandler;
 import org.apache.catalina.realm.JAASRealm;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.security.ContextManager;
-import org.apache.geronimo.security.realm.providers.PasswordCallbackHandler;
-import org.apache.geronimo.security.realm.providers.CertificateCallbackHandler;
-import org.apache.geronimo.security.realm.providers.CertificateChainCallbackHandler;
 import org.apache.geronimo.security.jacc.PolicyContextHandlerContainerSubject;
+import org.apache.geronimo.security.realm.providers.CertificateChainCallbackHandler;
+import org.apache.geronimo.security.realm.providers.PasswordCallbackHandler;
 import org.apache.geronimo.tomcat.JAASTomcatPrincipal;
 
 
@@ -58,11 +55,8 @@
 
     private static final Log log = LogFactory.getLog(TomcatGeronimoRealm.class);
 
-//    private Context context = null;
     private static ThreadLocal currentRequest = new ThreadLocal();
 
-    private boolean enabled = false;
-
     /**
      * Descriptive information about this <code>Realm</code> implementation.
      */
@@ -144,7 +138,7 @@
      *
      * @param request    Request we are processing
      * @param response   Response we are creating
-     * @param constraint Security constraint we are enforcing
+     * @param constraints Security constraints we are enforcing
      * @param context    The Context to which client of this class is attached.
      * @throws java.io.IOException if an input/output error occurs
      */
@@ -325,7 +319,8 @@
      */
     public Principal authenticate(String username, String credentials) {
 
-        CallbackHandler callbackHandler = new PasswordCallbackHandler(username, credentials.toCharArray());
+        char[] cred = credentials == null? null: credentials.toCharArray();
+        CallbackHandler callbackHandler = new PasswordCallbackHandler(username, cred);
         return authenticate(callbackHandler, username);
     }
 



Mime
View raw message