Websphere Can';t使用ibm-application-bnd.xml将角色映射到组
我正在尝试使用ibm-application-bnd.xml映射用户组。把它放到META-INF文件夹中。在“尝试访问安全”页面上,获取下一条消息:Websphere Can';t使用ibm-application-bnd.xml将角色映射到组,websphere,jaas,user-roles,Websphere,Jaas,User Roles,我正在尝试使用ibm-application-bnd.xml映射用户组。把它放到META-INF文件夹中。在“尝试访问安全”页面上,获取下一条消息: [08.05.15 17:42:21:242 MSK] 00000084 WebCollaborat A SECJ0129E: ... GET в null:/loginmodule/date/, Authorization failed, Not granted any of the required roles: user-role 当我
[08.05.15 17:42:21:242 MSK] 00000084 WebCollaborat A SECJ0129E: ... GET в null:/loginmodule/date/, Authorization failed, Not granted any of the required roles: user-role
当我尝试用ibm控制台配置它时,它可以工作。所有配置都写入ibm-application-bnd.xmi,而不是ibm-application-bnd.xml
我错了什么?
在Java1.6中使用WebSphereAS8.5.5
ibm-application-bnd.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/dxml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
xmlns="http://websphere.ibm.com/xml/ns/javaee" version="1.2">
<security-role name="user-role">
<group name="user-group" />
</security-role>
</application-bnd>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Constraint</display-name>
<web-resource-collection>
<web-resource-name>secrets</web-resource-name>
<description />
<url-pattern>/date/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user-role</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>user-role</role-name>
</security-role>
<servlet>
<servlet-name>date</servlet-name>
<servlet-class>ru.servlet.TimeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>date</servlet-name>
<url-pattern>/date/*</url-pattern>
</servlet-mapping>
</web-app>
30
index.html
约束
秘密
/日期/*
用户角色
用户角色
日期
ru.servlet.TimeServlet
日期
/日期/*
WebSphereApplicationServer仅对EE5+使用XML,并且该决定是基于每个部署描述符做出的。如果正在使用ibm-application-bnd.xmi,那么我怀疑您的application.xml的版本是=“1.4”或更低,所以在更新到EE 5 xml头后重试(删除doctype、添加xmlns、添加xmlns:xsi、添加xsi:schemaLocation、更新version属性)。我必须在我的ear POM maven ear插件中更改版本。因为默认情况下它会生成1.3application.xml,所以Websphere服务器只需要一个ibm-application-bnd.xmi文件,而不是ibm-application-bnd.xml文件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<version>6</version>
<security>
<security-role>
<role-name>manager</role-name>
</security-role>
</security>
<modules>
<webModule>
<groupId>${project.groupId}</groupId>
<artifactId>my-war</artifactId>
<contextRoot>/my-app</contextRoot>
</webModule>
</modules>
</configuration>
org.apache.maven.plugins
maven耳朵插件
6.
经理
${project.groupId}
我的战争
/我的应用程序
多亏了bMail,你救了我一天。将maven ear插件的POM中的版本更改为6,这样做了。看回答这确实是我问题的原因。检查ear项目目标目录中生成的application.xml很有帮助。顺便说一句,我还了解到您可以通过管理控制台导出ear,如果您手动应用安全角色,它将向您显示它正在使用的bnd.xml或.xmi文件。