What methods are used in the Shiro framework?
The methods used in the Shiro framework include the following aspects:
- Authentication: Shiro provides the functionality of verifying user identity through the use of the Subject object and its corresponding methods. Common authentication methods include username/password verification, single sign-on, and Remember Me.
- Authorization: Shiro provides functionality for controlling permissions. By using the Subject object and corresponding methods, it can determine if a user has a certain permission and decide whether to allow the user to perform the corresponding operation. Common authorization methods include role-based access control, permission-based access control, and custom access control.
- Session management: Shiro provides the ability to manage user sessions, including creating, retrieving, and destroying sessions. In Shiro, sessions are centered around the Subject object, which allows users to access their session information.
- Encryption and decryption: Shiro offers common encryption and decryption functions, including password encryption, data encryption, etc. By using Shiro’s encryption utility classes, data can be securely processed easily.
- Cache Management: Shiro can utilize caching to improve system performance by storing frequently accessed data and reducing the number of database queries, thus boosting system response times. Shiro supports various caching implementations like in-memory caching, Ehcache, and Redis.
- Web Integration: Shiro can be integrated with web frameworks like Spring MVC, Struts, etc. By integrating Shiro, functions such as intercepting web requests, controlling permissions, authenticating identities can be achieved. Shiro also provides some web-related filters, such as FormAuthenticationFilter, LogoutFilter, etc.
- Remember Me feature: Remember Me is an automatic login function that generates a persistent identifier (such as a cookie) when a user logs in, allowing them to be automatically logged in the next time they visit without having to enter their username/password again.
The above are some common methods of the Shiro framework, for specific usage, refer to the official documentation or related tutorials of Shiro.