0

我只想根据扩展名设置约束。我正在尝试使用以下内容 -

<security-constraint>
    <display-name>XYZRole</display-name>
    <web-resource-collection>
        <web-resource-name>XYZRole</web-resource-name>
        <url-pattern>*.bear</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>
        <description>Access to XYZRole</description>
        <role-name>XYZRole</role-name>
    </auth-constraint>
    
</security-constraint>

<security-constraint>
    <display-name>Secure Everything</display-name>
    <web-resource-collection>
        <web-resource-name>All resources</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>AllAuthenticated</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

和在属性文件中定义security.user.names.bearsecurity.user.roles.bear但它没有将有效租户列入白名单。

如何将扩展 URL 模式放入<security-constraint>

4

0 回答 0