SSO Single Sign-on

Source: Internet
Author: User
Tags php foreach

In a word, it is possible to bring different domain names back to the same authentication information.
The way to do this is to put one of the authentication information stored in a different domain under a cookie after landing,
When verifying whether or not to log in, the cookie is validated, and if it is a subdomain, this is set to the top of the scope directly with the cookie.
The following is a different domain name, which is the use of script function, respectively, to visit each page, such as domain name:
Www.a.com
Www.b.com
Www.c.com
Each domain name is delegated a index.php file for verification purposes,
The index.php test code is as follows:

<?phpprint_r ($_cookie);//Here the information in the cookie is parsed, and if the validation is passed, the generated cookie is written to the appropriate domain name?>

Assume that the unified landing page is
www.c.com/login.php,www.c.com/do.php first front-end verification, if correct, allows the submission of
The login.php code is as follows

<?phpsession_start ();? ><! DOCTYPE html>

The do.php code is as follows:

<?php$redirect = Empty ($_request[' redirect ')? ' http://www.a.com ': $_request[' redirect '];if (Empty ($_request[' username ']) | | empty ($_request[' password '])) {    Header (' loaction:http://'. UrlDecode ($redirect));  Exit;} $urls = Array (  ' www.a.com/a.php ',  ' www.b.com/a.php ',  ' www.c.com/a.php ');? ><! DOCTYPE html>

 

This allows direct access to the www.a.com/www.b.com/www.c.com to obtain cookie information.
The above is the basic principle, in each page to verify the judgment can be directly used, the general domain name is small,
Enough to use, generally not too many domain names

 

 

 

SSO Single Sign-on

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.