📜 ⬆️ ⬇️

Bicycle: cross-site authorization of own projects

It was discussed a lot and for a long time, like in a post ... I implemented my cross-site authorization bike.

So back to the problem:
There are several original projects (project1, project2, projectN ...) for which there should be a single authorization. That is, the User having logged in the project project1 had access to the project2 resources ... projectN as an authorized user.

As a rule, such projects are on a single hosting and it is desirable that they have a common (single) registration. So, if these conditions are met, then the solution described below can continue life in your project.
')
Restriction : all projects are in the same data center and are in the same local network. All projects have a single store for sessions and, accordingly, a single sid.

We agree that:


Pledging



Authorization



Authorization from another project



Output

We kill the key in memkesh or he dies himself

not an extra question

and what if the "alien" decides to log in to url project1.com/signin/#sid using your sid

Yes, it is quite possible ... You can intercept sid in urla with the same probability as intercepting a cookie in which the usual sid is stored.

Conclusion

Unified registration system assumes that the user is registered on sso.com
Access to sso.com data can be from any project. All transitions during registration by analogy with authorization, only the URL is different: sso.com/registration/project1 (project1 shows in which design to display the registration and where to return the user after registration)

Data on sso.com can (but not necessarily) be stored in a key / value database, for example BerkleyDB.

Ps. so that we don’t throw us on the login form too often, you need to use a patch for the memkesh - autoprolongate (about this in another topic)
This patch makes avtoprolongeyt at the same time after the last access to the data.

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


All Articles