Digest Access Authentication - Example With Explanation

Example With Explanation

The following example was originally given in RFC 2617 and is expanded here to show the full text expected for each request and response. Note that only the "auth" (authentication) quality of protection code is covered – at the time of writing, only the Opera and Konqueror web browsers are known to support "auth-int" (authentication with integrity protection). Although the specification mentions HTTP version 1.1, the scheme can be successfully added to a version 1.0 server, as shown here.

This typical transaction consists of the following steps.

  • The client asks for a page that requires authentication but does not provide a username and password. Typically this is because the user simply entered the address or followed a link to the page.
  • The server responds with the 401 "Unauthorized" response code, providing the authentication realm and a randomly-generated, single-use value called a nonce.
  • At this point, the browser will present the authentication realm (typically a description of the computer or system being accessed) to the user and prompt for a username and password. The user may decide to cancel at this point.
  • Once a username and password have been supplied, the client re-sends the same request but adds an authentication header that includes the response code.
  • In this example, the server accepts the authentication and the page is returned. If the username is invalid and/or the password is incorrect, the server might return the "401" response code and the client would prompt the user again.

Note: A client may already have the required username and password without needing to prompt the user, e.g. if they have previously been stored by a web browser.

Read more about this topic:  Digest Access Authentication

Famous quotes containing the word explanation:

    The explanation of the propensity of the English people to portrait painting is to be found in their relish for a Fact. Let a man do the grandest things, fight the greatest battles, or be distinguished by the most brilliant personal heroism, yet the English people would prefer his portrait to a painting of the great deed. The likeness they can judge of; his existence is a Fact. But the truth of the picture of his deeds they cannot judge of, for they have no imagination.
    Benjamin Haydon (1786–1846)