【发布时间】:2020-09-05 04:38:07
【问题描述】:
这是我在配置类中的方法:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.cors()
.and()
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(unauthorizedHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/v1/auth/signin", "/api/v1/auth/register")
.permitAll()
.anyRequest()
.authenticated();
http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
}
我说过 .anyRequest().authenticated();最后应该使'/api/v1/user'不返回所有用户,但确实如此。为什么?
【问题讨论】:
标签: hibernate spring-boot authentication spring-security jwt