Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java WebSphere Liberty Profile-如何在部署Spring Boot uber JAR时添加安全约束_Java_Spring Boot_Websphere Liberty - Fatal编程技术网

Java WebSphere Liberty Profile-如何在部署Spring Boot uber JAR时添加安全约束

Java WebSphere Liberty Profile-如何在部署Spring Boot uber JAR时添加安全约束,java,spring-boot,websphere-liberty,Java,Spring Boot,Websphere Liberty,我很高兴看到WebSphereLiberty概要文件支持在版本18.0.0.2中直接部署SpringBootSupportJAR 在my server.xml中,我有: <application id="x" name="x" type="spring" location="${server.config.dir}/apps/spring-boot-uber.jar"> <application-bnd>

我很高兴看到WebSphereLiberty概要文件支持在版本18.0.0.2中直接部署SpringBootSupportJAR

在my 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请求(用户主体)中设置身份验证信息

我怎样才能在SpringBoot应用程序中实现这一点,因为我既没有EAR也没有WAR(所以我没有web.xml文件)

我曾尝试将ibm-ws-bnd.xml添加到SpringBootUber jar的META-INF文件夹中,但似乎什么都没有发生

更新:


<> P>我甚至不确定WLP支持部署Spring Bug Uber jar时的应用程序BND,但是我不知道如何将角色绑定到它。

< P>您可能想考虑使用Spring Security在Spring Bug应用程序中提供用户详细信息和安全角色。到目前为止,liberty不支持应用程序bnd中定义了授权角色的Spring Boot应用程序JAR

或者,您可以将JAR文件转换为WAR,并将web.xml文件放在src/main/webapp/web-INF文件夹中,并在server.xml中提供应用程序类型为“WAR”