【发布时间】:2019-07-21 07:44:51
【问题描述】:
我很高兴看到 WebSphere Liberty Profile 在版本 18.0.0.2 中支持直接部署 Spring Boot 支持 JAR。
在我的 server.xml 我有:
<application id="x" name="x"
type="spring"
location="${server.config.dir}/apps/spring-boot-uber.jar">
<application-bnd>
<security-role name="Authenticated">
<special-subject type="ALL_AUTHENTICATED_USERS"/>
</security-role>
<security-role name="SUPER_USERS">
<group name="My_Admins"/>
</security-role>
</application-bnd>
</application>
注意安全角色绑定。
在 web.xml (WAR) 或 ibm-ws-bnd.xml (EAR) 中我想我需要这样做:
<?xml version="1.0" encoding="UTF-8"?>
<webservices-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ws-bnd_1_0.xsd"
version="1.0">
<http-publishing>
<webservice-security>
<security-constraint>
<web-resource-collection>
<web-resource-name>all</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>TRACE</http-method>
<http-method>POST</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Authenticated</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>All authenticated users</description>
<role-name>Authenticated</role-name>
</security-role>
<security-role>
<description>Super users</description>
<role-name>SUPER_USERS</role-name>
</security-role>
</webservice-security>
</http-publishing>
</webservices-bnd>
为了在 http 请求中设置身份验证信息(用户主体)。
如何在 Spring Boot 应用程序中使用它,我既没有 EAR 也没有 WAR(所以我没有 web.xml 文件)。
我尝试将 ibm-ws-bnd.xml 添加到 spring boot uber jar 的 META-INF 文件夹中,但似乎没有任何反应。
更新:
我什至不确定 WLP 在部署 Spring Boot uber JAR 时是否支持 application-bnd,但是我根本不知道如何将角色绑定到它。
【问题讨论】:
标签: java spring-boot websphere-liberty