ch12: Basic Authentication
Last updated
Last updated
Authentication means showing some proof of your identity.
HTTP defines two official authentication protocols: basic authentication and digest authentication.
Four phase of authentication:
Basic authentication example:
Web servers group protected documents into security realms.
Each security realm can have different sets of authorized users.
Basic authentication is the most prevalent HTTP authentication protocol.
Just username and password.
Figure 12.2 shows a detailed example of basic authentication.
Basic authentication headers:
HTTP basic authentication packs the username and password together (separated by a colon), and encodes them using the base-64 encoding method.
Proxy servers can be a convenient way to provide unified access control across an organization's resources.
The first step in this process is to establish the identity via proxy authentication.
Web server versus proxy authentication:
Basic authentication is simple and convenient, but it is not secure.
Given a base 64-encoded username and password, the decoding can be performed trivially by reversing the encoding process.
No effort is made to prevent these replay attacks.
Even if basic authentication is used for noncritical applications, social behavior makes this dangerous.
Many users use the same password among many web sites.
Basic authentication offers no protection against proxies or intermediaries that act as middlemen.
If a user can be led to believe that he is connection to a valid host protected by basic authentication when, in fact, he is connecting to a hostile server or gateway, the attacker can request a password, store it for later use, and feign an error.
Phase
Headers
Request
Challenge
401 WWW-Authenticate
Authentication
Authentication
Success
Authentication-Info
Challenge/Response
Header syntax
Challenge (server to client)
WWW-Authenticate: Basic realm=quoted-realm
Response (client to server)
Authorization: Basic base64-username-and-password
Web server
Proxy server
Unauthorized status code: 401
Unauthorized status code: 407
WWW-Authenticate
Proxy-Authenticate
Authorization
Proxy-Authorization
Authentication-Info
Proxy-Authentication-Info