[英]JBoss EAP 7 Basic Authentication not work
I change my application server to JBoss EAP 7.1 and configure JDBC Realm with this configuration : 我将应用程序服务器更改为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>
my web.xml file : 我的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>
my jboss-web.xml file : 我的jboss-web.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>web-security-domain</security-domain>
</jboss-web>
My problem is basic authentication not work with my configuration . 我的问题是基本身份验证不适用于我的配置。
actually firefox web browser don't open authentication popup dialog and only receive : 实际上, Firefox Web浏览器不会打开身份验证弹出对话框,而只会接收:
Internal Server Error 内部服务器错误
without any error in jboss log ! jboss日志中没有任何错误! . 。
How can fix this problem ? 如何解决这个问题?
Thank you . 谢谢 。
I Fixed this problem . 我解决了这个问题。
In Http Section configuration must be same : 在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>
Now work without any problem . 现在工作没有任何问题。
Thank you . 谢谢 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.