Thymeleaf coordinate expansion
<!--thyemleaf对shrio的扩展坐标--> <dependency> <groupId>com.github.theborakompanioni</groupId> <artifactId>thymeleaf-extras-shiro</artifactId> <version>2.0.0</version> </dependency>
Configuration ShiroDialect
Add getShiroDialect class which method ShiroConfig
/ ** * configuration ShiroDialect, for use with labels thymeleaf and shiro * / @Bean Public ShiroDialect getShiroDialect () { return new new ShiroDialect (); }
test.html file
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div shiro:hasPermission="user:add"> <a href="add">添加</a> </div> <div shiro:hasPermission="user:update"> <a href="add">更新</a> </div> </body> </html>
Effect: test.html will be chosen to hide the add or update the user's resources shiro
Here's authorized users
User authorized users from here: