In distributed environment, how to support multi-terminal session sharing such as PC and APP (ios and Android) is also a solution that all companies need. I think it is out of date to solve the problem by using the traditional session method. Can we find a general solution? For example, using traditional CAS for SSO sso between multiple systems or using oAUth’s third-party login scheme? Today, we will briefly explain the use of Spring Interceptor mechanism, JWT authentication mode, Redis distributed cache sso sso, without further discussion, directly record the steps to share with you:
- Introduce the related JAR packages of JWT into the project pom.xml:
Java code
- Interceptor configuration:
Java code
- Write JWT encryption or decryption tool class:
Java code
- Create login. Java object for JWT encryption or decryption:
Java code
- Define the RedisLogin object used to store user objects to Redis using uid:
Java code
Java code
Java code
Java code
Java code
I will record the construction process and essence of spring Cloud micro-service cloud architecture recently developed, so as to help more friends who are interested in developing Spring Cloud framework to discuss the construction process of Spring Cloud architecture and how to apply it to enterprise projects.
I personally invite all BATJ architecture masters to create Spring Cloud to build an exchange community of micro-service architecture. (Group number: 573988200) Welcome architects and developers to learn and exchange practical experience in using Spring Cloud’s many powerful components.
The reason why someone is always better than you is because they are already better and are constantly trying to become better, while you are still satisfied with the status quo and secretly happy! Rational use of their every minute every second of time to learn to improve themselves, do not use “no time” to cover up their ideological laziness! While young, hard to fight, to the future of their own account!
Hope this article can help you at the same time, also listen to your point of view. Welcome to comment, add attention, share your ideas! Keep updating!
To-morin Java architectureCopy the code
Share the latest Internet articles to pay attention to the latest development of the Internet