![](/img/trans.png)
[英]How to remove authentication from HTTPServerAuthModule in Jboss EAP
[英]JBoss EAP 7 Basic Authentication not work
我將應用程序服務器更改為JBoss EAP 7.1,並使用以下配置配置JDBC Realm:
# In security domains section :
<security-domain name="jdbcdomain" default-realm="jdbc-realm" permission-mapper="default-permission-mapper">
<realm name="jdbc-realm" role-decoder="from-roles-attribute"/>
</security-domain>
# In security realm section :
<jdbc-realm name="jdbc-realm">
<principal-query sql="SELECT PASSWORD FROM USERS WHERE USERNAME = ?" data-source="OracleDS">
<clear-password-mapper password-index="1"/>
</principal-query>
<principal-query sql="select r.rolename from roles r , users u , userrole ur where u.username=? and ur.user_id=u.id and r.id=ur.role_id" data-source="OracleDS">
<attribute-mapping>
<attribute to="roles" index="1"/>
</attribute-mapping>
</principal-query>
</jdbc-realm>
# In http section :
<http-authentication-factory name="http-db-auth" security-domain="jdbcdomain" http-server-mechanism-factory="global"/>
# In Subsystem "urn:jboss:domain:undertow:5.0" section :
<application-security-domains>
<application-security-domain name="web-security-domain" http-authentication-factory="http-db-auth"/>
</application-security-domains>
我的web.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>administrator</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
</web-app>
我的jboss-web.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>web-security-domain</security-domain>
</jboss-web>
我的問題是基本身份驗證不適用於我的配置。
實際上, Firefox Web瀏覽器不會打開身份驗證彈出對話框,而只會接收:
內部服務器錯誤
jboss日志中沒有任何錯誤! 。
如何解決這個問題?
謝謝 。
我解決了這個問題。
在Http節中的配置必須相同:
<http-authentication-factory name="http-db-auth" http-server-mechanism-factory="global" security-domain="jdbcdomain">
<mechanism-configuration>
<mechanism mechanism-name="BASIC"/>
</mechanism-configuration>
</http-authentication-factory>
現在工作沒有任何問題。
謝謝 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.