You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/03/10 23:01:18 UTC
svn commit: r1734466 - in /tomcat/trunk:
java/org/apache/catalina/realm/JAASMemoryLoginModule.java
webapps/docs/changelog.xml
Author: markt
Date: Thu Mar 10 22:01:18 2016
New Revision: 1734466
URL: http://svn.apache.org/viewvc?rev=1734466&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59154
Fix a NullPointerException in the JASSMemoryLoginModue resulting from the introduction of the CredentialHandler to Realms
Modified:
tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=1734466&r1=1734465&r2=1734466&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Thu Mar 10 22:01:18 2016
@@ -18,6 +18,7 @@ package org.apache.catalina.realm;
import java.io.File;
import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.util.Map;
@@ -41,8 +42,7 @@ import org.apache.tomcat.util.digester.D
* <p>Implementation of the JAAS <strong>LoginModule</strong> interface,
* primarily for use in testing <code>JAASRealm</code>. It utilizes an
* XML-format data file of username/password/role information identical to
- * that supported by <code>org.apache.catalina.realm.MemoryRealm</code>
- * (except that digested passwords are not supported).</p>
+ * that supported by <code>org.apache.catalina.realm.MemoryRealm</code>.</p>
*
* <p>This class recognizes the following string-valued options, which are
* specified in the configuration file and passed to {@link
@@ -54,6 +54,14 @@ import org.apache.tomcat.util.digester.D
* XML file containing our user information, in the format supported by
* {@link MemoryRealm}. The default value matches the MemoryRealm
* default.</li>
+ * <li><strong>digest</strong> - Digest used to protect credentials in the XML
+ * file. If not specified, the passwords will be assumed to be in clear
+ * text.</li>
+ * <li><strong>iterations</strong> - The number of iterations of the associated
+ * algorithm that will be used when creating a new stored credential for a
+ * given input credential.</li>
+ * <li><strong>saltLength</strong> - The salt length that will be used when
+ * creating a new stored credential for a given input credential.</li>
* </ul>
*
* <p><strong>IMPLEMENTATION NOTE</strong> - This class implements
@@ -223,9 +231,24 @@ public class JAASMemoryLoginModule exten
this.options = options;
// Perform instance-specific initialization
+ MessageDigestCredentialHandler credentialHandler = new MessageDigestCredentialHandler();
+ setCredentialHandler(credentialHandler);
if (options.get("pathname") != null) {
this.pathname = (String) options.get("pathname");
}
+ if (options.get("digest") != null) {
+ try {
+ credentialHandler.setAlgorithm((String) options.get("digest"));
+ } catch (NoSuchAlgorithmException e) {
+ log.warn("Invalid digest algorithm for JAASMemoryLoginModule", e);
+ }
+ }
+ if (options.get("iterations") != null) {
+ credentialHandler.setIterations(Integer.parseInt((String) options.get("iterations")));
+ }
+ if (options.get("saltLength") != null) {
+ credentialHandler.setIterations(Integer.parseInt((String) options.get("saltLength")));
+ }
// Load our defined Principals
load();
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1734466&r1=1734465&r2=1734466&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Mar 10 22:01:18 2016
@@ -188,6 +188,11 @@
added additional (and arguably unnecessary) validation to the provided
redirect location. (markt)
</fix>
+ <fix>
+ <bug>59154</bug>: Fix a <code>NullPointerException</code> in the
+ <code>JASSMemoryLoginModue</code> resulting from the introduction of the
+ <code>CredentialHandler</code> to <code>Realm</code>s. (schultz/markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org