[英]Spring Security roles issue
I overrode the method in the SpringWebConfig and I want to give all pages of application only for admins.我覆盖了 SpringWebConfig 中的方法,我只想为管理员提供所有应用程序页面。
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/*", "/**").hasRole("ADMIN");
}
When I try to open page http://localhost:8080/api/v1/skills/ without any authorization I have a correct result instead of 403. Maybe I'm wrong with my config?当我尝试在没有任何授权的情况下打开页面 http://localhost:8080/api/v1/skills/ 时,我得到了正确的结果而不是 403。也许我的配置有误? Full project https://github.com/Wismut/crud_developers完整项目https://github.com/Wismut/crud_developers
Add the following class inside config package在配置 package 中添加以下 class
package ua.wismut.config;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.