from where = ?"/-6ren">
gpt4 book ai didi

java - 无法通过 JBoss AS 7 安全子系统进行身份验证

转载 作者:行者123 更新时间:2023-12-01 13:16:14 25 4
gpt4 key购买 nike

我不明白如何使用密码的哈希值而不是开放密码。当我从 MS SQL 数据库获取打开密码时,一切正常。standalone.xml:

<security-domain name="SD" cache-type="default">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="<jndi>"/>
<module-option name="principalsQuery" value="select <open_pass> from <table> where <username> = ?"/>
<module-option name="rolesQuery" value="select <role>, 'Roles' from <table> where <username> = ?"/>
</login-module>
</authentication>
</security-domain>

web.xml:

<security-constraint>
<display-name>General</display-name>
<web-resource-collection>
<web-resource-name>/</web-resource-name>
<description/>
<url-pattern>/</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>administrators</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<description/>
<role-name>administrators</role-name>
</security-role>

但是当我尝试使用如下内容时:

<security-domain name="SD" cache-type="default">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="<jndi>"/>
<module-option name="principalsQuery" value="select <pass_hash> from <table> where <username> = ?"/>
<module-option name="rolesQuery" value="select <role>, 'Roles' from <table> where <username> = ?"/>
<module-option name="hashAlgorithm" value="SHA-1"/>
<module-option name="hashEncoding" value="base64"/>
</login-module>
</authentication>
</security-domain>

即使我输入正确的密码,我也会收到登录失败:javax.security.auth.login.FailedLoginException:密码不正确/需要密码pass_hash 字段在数据库中具有 varbinary(64) 类型。我错过了什么?

最佳答案

请检查DatabaseServerLoginModule

您是否还将 Base64 编码的密码存储在用户表中。

关于java - 无法通过 JBoss AS 7 安全子系统进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22443960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com