In the context of an HTTP transaction, the basic authentication scheme is a method designed to allow a web browser, or other client program, to provide credentials – in the form of a user name and password – when making a request. Although the scheme is easily implemented, it relies on the assumption that the connection between the client and server computers is secure and can be trusted. Specifically, the credentials are passed as plaintext and could be intercepted easily. The scheme also provides no protection for the information passed back from the server.
To prevent the user name and password being read directly by a person, they are encoded as a sequence of base-64 characters before transmission. For example, the user name "Aladdin" and password "open sesame" would be combined as "Aladdin:open sesame" – which is equivalent to QWxhZGRpbjpvcGVuIHNlc2FtZQ== when encoded in base-64. Little effort is required to translate the encoded string back into the user name and password, and many popular security tools will decode the strings "on the fly", so an encrypted connection should always be used to prevent interception.
One advantage of the basic authentication scheme is that it is supported by almost all popular web browsers. It is rarely used on normal Internet web sites but may sometimes be used by small, private systems. A later mechanism, digest access authentication, was developed in order to replace the basic authentication scheme and enable credentials to be passed in a relatively secure manner over an otherwise insecure channel.
The basic authentication scheme was originally defined by RFC 1945 (Hypertext Transfer Protocol – HTTP/1.0) although further information regarding security issues may be found in RFC 2616 (Hypertext Transfer Protocol – HTTP/1.1) and RFC 2617 (HTTP Authentication: Basic and Digest Access Authentication).
Here is a typical transaction between an HTTP client and an HTTP server running on the local machine (localhost). It is comprised of the following steps.
Note: A client may pre-emptively send the authentication header in its first request, with no user interaction required.
Client request (no authentication):
GET /private/index.html HTTP/1.0 Host: localhost
(followed by a new line, in the form of a carriage return followed by a line feed).
Server response:
HTTP/1.0 401 Unauthorised Server: SokEvo/1.0 Date: Sat, 27 Nov 2004 10:18:15 GMT WWW-Authenticate: Basic realm="SokEvo" Content-Type: text/html Content-Length: 311
Error 401 Unauthorised.
Client request (user name "Aladdin", password "open sesame"):
GET /private/index.html HTTP/1.0 Host: localhost Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
(followed by a blank line, as before).
Server response:
HTTP/1.0 200 OK Server: SokEvo/1.0 Date: Sat, 27 Nov 2004 10:19:07 GMT Content-Type: text/html Content-Length: 10476
(followed by a blank line and HTML text comprising of the restricted page).
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Basic authentication scheme".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world