Shiro practical tutorial (integrating SpringBoot, the strongest in the whole network)

This article introduces a powerful Shiro practical tutorial, using the simplest code and the most commonly used scenarios to let you fully master the usage of Shiro and become a master of Shiro combat. This Shiro tutorial is the strongest Shiro actual combat tutorial on the whole network.

Tutorial address: Shiro project practical column introduction - self-study wizard

Why is this Shiro tutorial the strongest in the whole network?

Characteristics of other materials

  1. The code is incomplete and doesn't work at all .
  2. It does not include the comparison and testing of various functions such as permission or not, authentication, and authentication.
  3. Only controls authentication (authentication) or authorization (authorization), the coverage is too narrow .
  4. Important functions such as controlling permissions through annotations and controlling permissions through URLs are not shown .
  5. Some third-party libraries with many bugs are used .
  6. There are few diagrams and no step-by-step testing process.
  7. The code cannot be used directly in the project , not even a good demo.

The result is: learning is equal to learning in vain , and you can't use it in the project !

Characteristics of Self-taught Elf

  1. The code is very complete, download the compressed source code package, and IDEA will run directly .
  2. Including the comparison and testing of various functions such as permission or not, authentication, authentication, etc.
  3. Controls authentication and authorization, covering common scenarios .
  4. Demonstrate important functions such as controlling permissions through annotations and controlling permissions through URLs .
  5. It uses very stable tools such as Spring's own .
  6. The diagram is very detailed , and there is a step-by-step test process.

The result is: after learning, you can master the authority control , the code can be directly used in the project , and you can complete the user management project independently !

The project skills you will master after learning this column

  1. Use Shiro to integrate JWT, and use annotations to control user permissions (commonly used in work)
  2. Use Shiro to integrate JWT, and use url to control user permissions (commonly used in work)
  3. Use Shiro to integrate Session, and use annotations to control user permissions (commonly used in old projects)
  4. Use Shiro to integrate Session and use redis to control user permissions (commonly used in old projects)

After learning the above items, you can independently develop a user management system! The user management system is generally necessary for each project, and it must be mastered by intermediate and advanced Java development.

After completing this column, you will be able to answer the following questions

  1. How to write the user login and logout interface?
  2. How to save the user account and password to the database? How are passwords encrypted?
  3. How to control the effective time of user login? For example: After allowing the user to log in for 2 days, he must log in again, what should he do?
  4. Some interfaces allow anonymous access, while others must be logged in to access, what should I do?
  5. After logging in, must you be able to access all interfaces?
  6. What if super administrators have all permissions, order administrators can only access orders, and product administrators can only access products?
  7. If you were asked to be responsible for a user management system independently, would you be able to complete it?

The project scene of this column

This article assumes a mall system. The roles are as follows

  • admin (super administrator): has all permissions
    • Use shiro wildcards: *:*
  • productManager (product administrator): has all rights to product (product)
    • product:add,product:delete,product:edit,product:view
  • orderManager (order administrator): has all permissions of order (order)
    • order:add,product:delete,product:edit,product:view

This column will take you to experience the following functions of the project:

  1. When you are not logged in, you can only access anonymous interfaces, such as: login
  2. After logging in, the super administrator can operate all interfaces, such as: edit products, edit orders
  3. After logging in, the product administrator can operate the product interface, such as: edit the product, but cannot operate the order interface, such as: edit the order
  4. After logging in, the order administrator can operate the order interface, such as: edit order, but cannot operate the product interface, such as: edit order
  5. The delete function can only be accessed by super administrators, product administrators cannot delete products, and order administrators cannot delete orders
  6. After the login times out, the interface cannot be accessed.

Guess you like

Origin blog.csdn.net/feiying0canglang/article/details/131909350