Home  >  Article  >  Backend Development  >  Ideas for implementing SSO across main domains_PHP tutorial

Ideas for implementing SSO across main domains_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:38:291004browse

The idea of ​​implementing SSO across main domains

There are many ways to share SESSION data among multiple servers under the same main domain (ie: all subdomain names under the same first-level domain name), so I won’t go into details here!

The key issue now is the implementation of SSO in different main domains! This problem is relatively complex and can be implemented, but many of it is supported by some special software systems. . .

Actually, SESSION also needs COOKIE to support it. COOKIE does not support cross-main domain, which means that SESSION cannot cross main domain! So, how to achieve cross-main domain? ? ?

This is another simple method that suddenly came to my mind when I was implementing SSO in my project, for everyone to discuss

1. Assume that there are A.COM, B.COM, C Among the three main domains of .COM, A.COM is mainly responsible for verifying passes (faster), B.COM and C.COM are specific applications

2. B.COM and C.COM and Some of A.COM's own applications need to go to A.COM to gain trust (login)

3. Assign a subdomain passport.B.COM, passport.C.COM to each main domain, and their IPs All point to the host address where A.COM is located

4. After the user passes the login verification, set up a jump rule, using session_id as a parameter, to jump to passport.B.COM, passport.C.COM one by one ( In fact, these subdomains can be established to the default site of host A, and quick jumps can be achieved one by one through arrays and some parameters). The jumps can be made directly using PHP's header("Location: passport.B.COM/?sid=xxxxxxxx&i= 0"); , while jumping, just overwrite the session_id of the current main domain with the passed session_id.

Here are some considerations:
1. Allocating each passport. . .
2. Jumping on the same host can avoid errors in the intermediate jump link causing jump failure.

I have only tested it on the local simulated multi-master domain, and the effect is good; I have not tested it on the INTERNET network yet. Please try it when you have time and come up with a better SSO solution.. .

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/735114.htmlTechArticleCross-main domain, the idea of ​​​​implementing SSO is the same main domain (that is: all sub-domain names under the same first-level domain name ), there are many ways to implement multi-server sharing of SESSION data, so I won’t go into details here! ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn