关于security的权限问题

来源:5-3 权限控制

背影淋湿了脸

2018-10-30

图片描述
http.authorizeRequests()
.antMatchers("/admin/login").permitAll()
.antMatchers("/static/").permitAll()
.antMatchers("/user/login").permitAll()
.antMatchers("/admin/
").hasRole(“ADMIN”)
.antMatchers("/user/").hasAnyRole(“ADMIN”,“USER”)
.antMatchers("/api/user/
").hasAnyRole(“ADMIN”,“USER”)
.and()
.formLogin()
.loginProcessingUrl("/login")//配置角色登陆配置处理入口
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/logout/page")
.deleteCookies(“JSESSIONID”)
.invalidateHttpSession(true)
.and()
.exceptionHandling()
.authenticationEntryPoint(entryPoint())
.accessDeniedPage("/403");
http.csrf().disable();
http.headers().frameOptions().sameOrigin();

老师好,为什么已经登陆了,访问admin目录下或者user目录下的页面,总显示无权限呢

写回答

1回答

背影淋湿了脸

提问者

2018-10-31

这个问题已经解决了

1
1
丶HanGH
请问你是怎么解决的呢
2018-12-07
共1条回复

BAT大牛亲授 基于ElasticSearch的搜房网实战

ES+MySQL+Kafka,打造强力站内搜索

898 学习 · 285 问题

查看课程