小编dec*_*eck的帖子

Servlet 3.1 - 安全约束 - 没有web.xml

Java Servlet 3.0和3.1规范允许开发人员使用Java代码执行许多常见的基于配置的任务,而不是通过提供web.xml文件的传统机制.

我已将所有这些工作用于我的应用程序,但在寻求解决应用程序安全性时,我找不到任何关于如何或是否可以通过代码配置应用程序安全性约束的参考.

基本上,我正在寻找一种程序化的方法来执行以下操作:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>my-secure-webapp</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>SSORole</role-name>
    </auth-constraint>
</security-constraint>
<login-config>
    <auth-method>CLIENT-CERT</auth-method>
</login-config>
<security-role>
    <role-name>SSORole</role-name>
</security-role>
Run Code Online (Sandbox Code Playgroud)

有人知道这样做的方法吗?

谢谢

java security web.xml servlets

4
推荐指数
1
解决办法
1745
查看次数

标签 统计

java ×1

security ×1

servlets ×1

web.xml ×1