【发布时间】:2018-04-28 03:03:31
【问题描述】:
只是想看看我是否以正确的方式解释answer to this question。
如果我们只需要像这样保护一条路径:
http.antMatcher("/api/**").authorizeRequests()....
然后使用antMatcher()。
如果我们需要像这样保护多个 URL 路径:
http
.authorizeRequests()
.antMatchers("/high_level_url_A/sub_level_1").hasRole('USER')
.antMatchers("/high_level_url_A/sub_level_2").hasRole('USER2')
...
然后使用antMatchers()。
this question 中有两个答案,但每个答案中提供的示例与另一个中给出的示例相矛盾。第一个回答说作者不需要antMatcher(),第二个回答说总是以`antMatcher() IIUC开头。
【问题讨论】:
标签: java spring-mvc spring-boot spring-security