Workflow for Basic authentication [HTTP]

Source: Internet
Author: User

The basic authentication of HTTP involves two fields, one is the request field Authorization;

Authorization:basic xxx

One is the response field Www-authenticate

Www-authenticate:basic realm= "xxx"

1. When the browser tries to access a resource that requires authentication, the request message is sent in the normal form;

2. However, the server will return a http/1.1 401 Unauthorized response message with the Www-authenticate field, which may carry entities, but the General browser will not render the page;

http/1.1 401 Unauthorizedserver:nginx/1.9.9date:sat, 2018 05:32:18 gmtcontent-type:text/html; Charset=utf-8transfer-encoding:chunkedconnection:keep-alivex-powered-by:php/7.0.1www-authenticate:basic realm= " Git Server "

3. After the browser receives the message, the popup user password box asks the user to enter the account password;

4. After the user enters the account password to determine, the request message sends again, but at this time the message carries the Authorization field, it carries the account password which the user just entered (according to [User: password] form in series, then base64 the encoded string);

GET http://www.test1.com/test_19.php http/1.1host:www.test1.comconnection:keep-alivecache-control:max-age= 0authorization:basic d2fuzzoxmjm0nty=upgrade-insecure-requests:1user-agent:mozilla/5.0 (Windows NT 10.0; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/64.0.3282.186 Safari/537.36accept:text/html,application/xhtml+xml , Application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8accept-encoding:gzip, deflateaccept-language:zh-cn,zh;q= 0.9

5. The service side receives the message, determines whether the user input authentication is correct, if the correct return message will carry the entity, if is incorrect, returns the 2nd step;

Workflow for Basic authentication [HTTP]

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.