Introduction: CAS is a qualified Java development engineer must master the knowledge, fox will write down their own understanding, this article only represents my summary and understanding, if there are mistakes, welcome to correct…

Single sign-on, also known as Single Sign On, or SSO for short, can be shared based On user sessions. There are two types of Single sign-on.

1, Redis+Cookie distributed session to achieve [same top-level domain; based on Redis]

2. CAS System (Central Authentication Service) [Different top-level domain names; independent login system]

Summary of CAS single sign-on implementation:

3 key information: 1. Create user global session (user information stored in Redis) 2. Global ticket (stored in cookies on CAS terminal) 3. * Unified CAS Login interface * Purpose: * 1. Create a global session for the user after login -> uniqueToken * 2. Create a global userTicket, which indicates whether to log in to the CAS server. -> userTicket * 3. Create a temporary ticket for the user. -> tmpTicketCopy the code
/** * Example: * We went to the zoo to play, and bought a unified ticket at the gate, which is the global ticket and user global session of CAS system. * There are some small attractions in the zoo, you need to use your ticket to get a one-time ticket, with this ticket can go to some small attractions. * Such a small scenic spot is actually our corresponding site here one by one. * This temporary note needs to be destroyed when we have finished using it. * /Copy the code

The general logic is:

1. The front end first determines whether the user has logged in, that is, whether there is user information in the cookies. If there is user information, the cookies will be directly released.

2. If there is no user information in the cookies, determine whether there is a temporary ticket and verify it. If it passes, release it and save the user information in the cookies

3. In the login process, determine whether there is a global ticket in the cookies. If there is a global ticket, it means that you have logged in, and then return a temporary ticket. If you do not have a global ticket, go to the CAS login page for login.

Reference blog:

Blog.csdn.net/u013250861/…

Blog.51cto.com/u_15091675/…


Conclusion: Ever is to learn to read people’s blog technology, some of them have essence blog also have to play around the CV of solution, so the decided to study the knowledge sharing for everyone, mainly want to go to the sea after less detours, more positive energy blog, if there are any errors, welcome to point out mistakes, only hope that we can learn knowledge in my blog, Solve the problem, then it is enough. Thank you! (Please note the original source for reprint)