One
complete the dynamic authorization function for authenticated users
Tip: According to the current authenticated user query database, get their corresponding permissions, for their authorization
Operation Steps:
- In realm 's authorization method , get to the currently logged-in user by using the Principals object
- Create an authorization information object
- List of roles based on user query and traverse list of roles
- Add role keywords to the role properties of the authorization information object in the loop body
- According to the user query permission list, and traverse the permission list
- Add a permission keyword to the permission property of an authorization information object in the loop body
- Determine whether a user is a system administrator based on the user query role and permissions method in the role and Permissions service class
- If the system administrator queries out all roles and permissions
- If not, the corresponding roles and permissions are based on the user's query
One
complete S
Hiro
Integration E
Hcache
Cache Permission Data
hint: introduce Ehcache dependency, provide ehcache core configuration file, configure Cache Manager object and inject to Security Manager object
Operation Steps:
- introducing The coordinates of Ehcache in Pom.xml
- provides core configuration files for Ehcache
- registering a Ehcache Cache Manager object in the spring configuration file, injecting the Ehcache core profile path to the Cache manager Object
- in the Configure the Cache Manager property for the Ehcache cache Manager object in the Shiro security Manager
Business logic: Five, complete authentication user's dynamic authorization function vi. complete Shiro integration Ehcache cache permissions Data