【发布时间】:2016-11-09 05:11:39
【问题描述】:
我正在使用 Spring REST(没有 web.xml)构建一个应用程序。 REST 调用工作正常,但我需要添加一些易于通过 web.xml 添加的安全约束,但由于我使用的是没有 web.xml 的 Spring 4,所以我需要帮助通过 Java 配置添加 web.xml 部分。
我的web.xml:
<security-role>
<role-name>all</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>test</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>all</role-name>
</auth-constraint>
</security-constraint>
我需要通过 Java 配置来配置这个 web.xml 的帮助。可能这可以通过 Spring Security 添加,但不确定如何添加。
【问题讨论】:
标签: java spring spring-mvc spring-security configuration