Sina SSO login process analysis [Single Sign-On Analysis]

Source: Internet
Author: User
Recently I have studied the Sina CAS login process and found that Sina SSO implements Yale-CAs and adds a bit of new things. The interaction process of the basic authentication process remains unchanged. The original idea is to implement Single-point Ajax login, which is quite cool. The implementation principle is IFRAME + Javascript Callback function.

I. Basic SSO

The basic SSO is to implement unified login under the same top-level domain name by planting cookies for top-level domain names. For example:

Single Sign-On address: sso.xxx.com/login.jsp

Application 1: web1.xxx.com/login.jsp

Application 2: web2.xxx.com/login.jsp

Application 3: web3.xxx.com/login.jsp

Login process:

Scenario 1: (the user has never logged on)

1. the user accesses web1.xxx.com/login.jsp and redirects web1 to sso.xxx.com/login.jsp.

2. user input for verification, successful. The tokenid of the cookie in the .xxx.com domain of sso.xxx.com is redirected to web1.xxx.com/login.jsp, And the tokenid of the cookie in the .xxx.com domain accessed by web1.xxx.com determines that the system has logged on.

Scenario 2: (the user has logged on) log on directly.

Ii. Sina SSO

Sina implements cross-domain unified login, which is based on cookies in essence. If you disable cookies, you cannot log on to them in any way. For example, the Sina SSO server is login.sina.com.cn/sso/login.php.

The Weibo login address is weibo.com/login.php. The callback function and IFRAME are used to implement cross-level domain name login.

The authentication process is as follows: This section only describes the process that the user has never logged on.

1. Enter weibo.com/login.php

2. Enter the user name. After the user name is entered, when the focus of the user name input box is lost, the page number sends a request to the server login.sina.com.cn/sso/prelogin.php through Ajax. The parameter is user (the user name just entered ). The service returns server time and nonce authentication and writes the data to JavaScript variables through the callback function.

3. Enter the password and click Login. the post request is sent on the page (it must be noted that it is an Ajax request not sent by login. php ),

Login.sina.com.cn/sso/login.php? Client = ssologin. JS (v1.3.12), the request is initiated on an invisible IFRAME page in weibo.com/login.php. The parameters are the server time and nonce obtained in step 2, the user name and encrypted password. The returned cookie TGT is in login.sina.com.cn. Modify the IFRAME address to weibo.com/ajaxlogin.php? Ticket = xxxxxx. Note that ticket is very important. This is the credential for user login and service.

4. How does IFRAME access weibo.com/ajaxlogin.php? Ticket = xxxxxx: User Login. The returned cookie is under .weibo.com to record user login information.

5. Access weibo.com/login.php again through Js. Because the cookie has been written, the login succeeds, and the server sends 302 to redirect to the user's homepage. Weibo.com/userid.

6. Now, the login process is complete.

 

Not complete ....

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.