【发布时间】:2019-12-20 18:13:16
【问题描述】:
目前我正在使用 Spring Security,我有管理员登录和员工登录。问题是当我以员工身份登录时,我想隐藏一个重定向到管理员主页的按钮。 以员工身份登录时,我可以以某种方式使其隐藏或不可点击吗? 此外,它还在 showCustomer.html 中,管理员可以在其中删除和编辑预订。 总结一下;以员工身份登录时可以隐藏 html 元素吗?
代码:
protected void configure (HttpSecurity httpSecurity) throws Exception {
httpSecurity.csrf().disable();
httpSecurity.authorizeRequests()
.antMatchers("/admin", "/opretBooking", "/showCustomer", "/editCustomer", "/sletBooking", "/medarbejder").hasRole("ADMIN")
.antMatchers("/user", "/showCustomer", "/medarbejder").hasRole("USER")
.antMatchers("/**").permitAll()
.and().formLogin().loginPage("/login").and().logout().permitAll();
【问题讨论】:
-
Spring Security 是否提供该 html 页面?
标签: java spring spring-boot spring-mvc spring-security