使用JDBCRealm的Tomcat 9 DIGEST - 仅接受摘要,而不接受密码

时间:2016-04-23 11:00:01

标签: tomcat digest-authentication jdbcrealm

新安装的tomcat 9 - 将应用程序从tomcat 8迁移到tomcat 9.

验证我的配置是使用带有mysql数据库的JDBCRealm。下面的配置与tomcat 8运行良好,但在tomcat 9上只接受密码摘要而不是“人”密码(摘要存储在表tomcat_users中)而不是通常的密码。因此,当在FORM登录页面中提交人类可读密码时,似乎不会执行摘要算法MD5。

server.xml中的配置是

<Realm className="org.apache.catalina.realm.JDBCRealm" connectionName=“..." connectionPassword=“..." connectionURL="jdbc:mysql://127.0.0.1:3306/TOMSCHEMA" digest="MD5" driverName="org.gjt.mm.mysql.Driver" roleNameCol="role_name" userCredCol="password" userNameCol="user_name" userRoleTable="tomcat_users_roles" userTable="tomcat_users"/>

对于应用程序,身份验证方法为FORM,对于另一个应用程序中的相应API,身份验证方法为DIGEST。两个应用程序都在交叉环境中相互看到。该应用程序的web.xml包含:

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>NAME</realm-name>
    <form-login-config>
        <form-login-page>/WEB-INF/security/protected/login.jsp</form-login-page>
        <form-error-page>/WEB-INF/security/protected/error.jsp</form-error-page>
    </form-login-config>
</login-config>

这里有什么问题?这一切都非常“标准”......为了与FORM身份验证页面再次使用DIGEST进行人工密码输入,我使用了什么shell,就像我使用tomcat 8一样?

非常感谢您提前

此致

1 个答案:

答案 0 :(得分:2)

现在您需要在server.xml中添加额外的行以符合旧的摘要方法:

&#13;
&#13;
     <Realm className="org.apache.catalina.realm.JDBCRealm"
        driverName="org.apache.derby.jdbc.EmbeddedDriver"
        connectionURL="jdbc:derby:/tomcat/db/zzz;create=false"
        connectionName="zzz"
        connectionPassword="zzz"
        userTable="login"
        userNameCol="login"
        userCredCol="passwd"
        userRoleTable="roles"
        roleNameCol="role"
      >
        <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler"
          algorithm="MD5"
          iterations="1"
          saltlenght="0"
        />
      </Realm>
&#13;
&#13;
&#13;

相关问题