📜 ⬆️ ⬇️

Cross Site Authorization 2

According to the results of the post made in July 2009 and lengthy trials, we came to a simple and optimal for us cross-site authorization scheme.

The task is to organize cross-site authorization between projects hosted on different domains (site1.com, site2.com). A user autologizing on one project receives authorization for all (Single Sign On). The same with the exit button (Single Sign Out). Each project has access to the session storage and database. On both projects, authorization is not required.
I want to emphasize that the issues of registration, storage and transmission of user data are not currently discussed, only the authorization is interested.

The task can be divided into three main parts:
  1. Authorization - the user entered the login and password in the form.
  2. Automatic authorization - the user clicked "remember me", or is already authorized on one of the projects.
  3. Exit - the user pressed the "exit" button.

We agree that:

Authorization


User on site.com fills out a form. We encrypt in one line (token) and send a redirect to sso.com:sso.com accepts the GET request, decrypts the data and checks the token creation time (no more than 2 minutes) and login / password:

Auto login


User logs on to site.com. Checking session cookie:

Output


The user on site.com presses the "exit" button. We lower the session, delete the session cookie, and redirect to sso.com with the encrypted return address. sso.com deletes the session cookie and the connection of the session ID with the user ID in the database. User logged out!

As you understand, this scheme works with any number of projects. A user logging in to one of them will be logged in at all. Same with the "exit" button.
')
I would be glad if our experience will be useful to you. Constructive criticism is welcome.

Update: Thank you DileSoft and divedeep for the valuable comments that are taken into account in this scheme.

Source: https://habr.com/ru/post/80900/


All Articles