目录
SpringSecurity可以在一些视图技术中进行控制显示效果。例如Thymeleaf中,只有登录用户拥有某些权限才会展示一些菜单
org.thymeleaf.extras thymeleaf-extras-springsecurity5
- html>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
- <head>
- <meta charset="UTF-8">
- <title>主页面title>
- head>
- <body>
- <h1>主页面h1>
- <ul>
- <li sec:authorize="hasAnyAuthority('/reportform/find')"><a href="/reportform/find">查询报表a>li>
- <li sec:authorize="hasAnyAuthority('/salary/find')"><a href="/salary/find">查询工资a>li>
- <li sec:authorize="hasAnyAuthority('/staff/find')"><a href="/staff/find">查询员工a>li>
- ul>
- <a href="/logout">退出登录a>
- body>
- html>