TOC 
DraftD. Recordon
 VeriSign
 J. Hoyt
 JanRain
 B. Fitzpatrick
 Six Apart
 June 29, 2006

OpenID Authentication 2.0 - Draft 5

Abstract

OpenID Authentication provides a way to prove that an End User owns an Identifier. It does this without passing around a password, email address, or other sensitive information.

OpenID is decentralized. No central authority must approve or register Relying Parties or Identity Providers. An End User can freely choose which Identity Provider to use while preserving their Identifier if they switch Identity Providers.

While nothing in the protocol requires JavaScript or modern browsers, the authentication scheme plays nicely with "AJAX"-style setups, so an End User can prove their Identity to a Relying Party without having to leave the page they are on.

Extensions are being built on top of the foundation created by OpenID Authentication to provide mechanisms for exchanging arbitrary End User-related data.



Table of Contents

1.  Requirements Notation
2.  Terminology
3.  Overview
    3.1.  Protocol Flow
4.  Initiation and Discovery
    4.1.  Initiation
    4.2.  Discovery
        4.2.1.  Delegating Authentication
        4.2.2.  Discovered Information
        4.2.3.  Using Yadis or XRI Resolution
        4.2.4.  HTML-Based Discovery
5.  Communication Types
    5.1.  Direct Communication
        5.1.1.  Direct Request
        5.1.2.  Direct Response
    5.2.  Indirect Communication
        5.2.1.  HTTP Redirect
        5.2.2.  HTML FORM Redirection
6.  Establishing Associations
    6.1.  Generating Signatures
    6.2.  Association Handles
    6.3.  Association Types
        6.3.1.  HMAC-SHA1 Associations
        6.3.2.  HMAC-SHA256 Associations
    6.4.  Association Sessions
        6.4.3.  Clear-Text Association Sessions
        6.4.4.  Diffie-Hellman Association Sessions
7.  Requesting Authentication
    7.1.  Request Parameters
    7.2.  Trust Roots
    7.3.  Immediate Requests
8.  Responding to Authentication Requests
    8.1.  Positive Assertions
    8.2.  Verifying Assertions
        8.2.1.  Verifying Discovered Information
        8.2.2.  Verifying Signatures
    8.3.  Identifying the End User
    8.4.  Negative Assertions
        8.4.1.  In Response to Immediate Requests
        8.4.2.  In Response to Non-Immediate Requests
9.  Discovering Identity Relying Parties
10.  Security Considerations
11.  Examples
    11.1.  Delegation
    11.2.  XRDS
    11.3.  HTML Identifier Markup
    11.4.  Login Form
    11.5.  XRI CanonicalID
12.  Extensions
Appendix A.  Diffie-Hellman Default Value
Appendix B.  Error Responses
Appendix C.  Changes from the Previous OpenID Specification
Appendix C.1.  Updated Initiation and Discovery
Appendix C.2.  Security improvements
Appendix C.3.  Extensions
13.  Normative References
§  Authors' Addresses




 TOC 

1. Requirements Notation

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119] (Bradner, B., “Key words for use in RFCs to Indicate Requirement Levels,” .).



 TOC 

2. Terminology

End User:
The person who wants to prove ownership of an Identifier to a Relying Party.
Identifier:
An Identifier is a URL or XRI. The OpenID Authentication protocol proves that an End User owns a URL or XRI.
Claimed Identifier:
An Identifier that the End User claims to own that has not yet been verified by the Relying Party.
Verified Identifier:
An Identifier that the End User has proven to a Relying Party that they own.
Relying Party:
A Web application that wants proof that the End User owns an Identifier.
IdP:
Identity Provider. This is the OpenID Authentication server that a Relying Party contacts for cryptographic proof that the End User owns the Claimed Identifier.
IdP Identifier:
An Identifier which represents an IdP.
User-Agent:
The End User's Web browser.



 TOC 

3. Overview

The OpenID Authentication protocol provides a way to prove that an End User owns an Identifier. In essence, the protocol allows a service to proxy its authentication decisions to another service specified by the End User. OpenID uses only standard HTTP requests and responses, so does not require any special capabilities of the User-Agent or other software.

The End User initiates the protocol either with a Claimed Identifier provided or an IdP Identifier. If an IdP Identifier is provided, the IdP MAY assist the End User in selecting an identifier. For example, the IdP might automatically generate a different Identifier for each different Relying Party so that the End User cannot be tracked across different sites.



 TOC 

3.1. Protocol Flow

  1. The End User initiates authentication (Initiation) by supplying a Claimed Identifier or IdP Identifier to the Relying Party. The Relying Party performs discovery (Discovery) on the End User-provided identifier and establishes the location of the service that the End User uses for authentication.
  2. (optional) The Relying Party and IdP exchange information on how to cryptographically sign the request and responses. This information is referred to as an "association." OpenID associations (Establishing Associations) consist of a "handle," which is an identifier for the association, an "association type," and the data that is needed by that association type.
  3. The Relying Party sends the End User to the IdP with an OpenID authentication request (Requesting Authentication).
  4. The IdP establishes whether the User-Agent is authorized to perform OpenID authentication and wishes to do so. Depending on the form of the request, the IdP may be able to interact with the End User in order to establish that they are authorized to approve OpenID authentication.
  5. The IdP sends the End User back to the Relying Party with a signed assertion if the authentication is approved (Positive Assertions) or an indication that OpenID authentication failed (Negative Assertions) if it was not approved.



 TOC 

4. Initiation and Discovery

Identifiers in OpenID are URLs or XRIs. The OpenID Authentication protocol starts with an End User submitting an identifier to the Relying Party. The Relying Party examines the user input, normalizes it, and performs discovery based on the normalized identifier. After successful discovery, the Relying Party has sufficient information to perform a request to an identity provider.



 TOC 

4.1. Initiation

To initiate OpenID Authentication, the Relying Party presents the End User with a form that has a field for entering their identifier or the identifier of their identity provider. It is RECOMMENDED that every Relying Party places the OpenID logo at the beginning of the form field where the End User enters their Identifier. It is RECOMMENDED that the form field be named "openid_url" so User-Agents will auto-complete the End User's Identifier.

The End User's input is then normalized into an identifier. If the End User supplies input that does not include a scheme (http, https, or xri), then the application needs to determine if the input is an XRI or a URL missing the http://. To do so, the application should examine the first character of the input. If it is an XRI Global Context Symbol, (Section 2.2.1.1 of XRI Syntax) then the input should be treated as an XRI. If it is not, then the input should be treated as an http URL, and prefixed with the scheme http://.

URL identifiers MUST be further normalized by following redirects when retrieving their content, and applying the rules in section 6 of RFC 3986 (Normalization and Comparison) to the final destination URL.



 TOC 

4.2. Discovery

Discovery consists of taking an identifier and extracting the necessary information for initiating authentication. OpenID has three paths through which to do discovery. If the identifier is an XRI, XRI resolution will yield an XRDS document that contains the necessary information. If it is a URL, the Yadis protocol is first attempted. If it succeeds, the result is again an XRDS document. If the Yadis protocol fails, the URL is retrieved and HTML-based discovery is attempted on the content located by the URL.



 TOC 

4.2.1. Delegating Authentication

By including an alternate Identifier in the discovery response, the Relying Party can be instructed to request authentication using that identifier rather than the one that was entered. Upon successful authentication, the Relying Party recognizes the End User using the entered identifier.

Delegation allows the End User to use a URL or XRI as an identifier without having to perform any configuration other than specifying what should be returned by discovery. This allows a broad range of URLs and XRIs to be used, without requiring any non-standard capabilities of the URL host. Delegation also allows an End User to keep the same Identifier over many years, even as services come and go; they'll just keep changing who the identifier delegates to for authentication.



 TOC 

4.2.2. Discovered Information

Upon successful completion of discovery, the Relying Party will have the following information:

IdP Endpoint URL:
The URL that accepts authentication requests on behalf of the End User. This MUST be an absolute URL.
Delegate Identifier:
(optional) The Identifier that should be sent in the authentication request to the IdP. The Delegate Identifier is never present when the End User enters an IdP's Identifier.
Claimed Identifier:
(optional) The normalized Identifier upon which discovery was performed. It is only present if the End User did not enter an IdP Identifier.



 TOC 

4.2.3. Using Yadis or XRI Resolution

If a URL is supplied, the Relying Party MUST attempt the Yadis protocol on that URL. The Yadis protocol and XRI resolution both yield an XRDS document. This is a simple XML document with entries for services that are related to the identifier.

Once the Relying Party has obtained an XRDS document, it MUST first check for a <Service> element describing an IdP Endpoint. If no IdP Endpoint is found, it MUST check for a <Service> element describing a Claimed Identifier.



 TOC 

4.2.3.1. IdP Identifiers

If the entered Identifier is an IdP Identifier, the OpenID information is contained in a service element with the following information:

An <xrd:Type> tag whose text content is "http://openid.net/server/2.0"
An <xrd:URI> tag whose text content is The IdP Endpoint URL



 TOC 

4.2.3.2. Claimed Identifiers

If the entered identifier is a Claimed Identifier, the remaining OpenID information is contained in a <xrd:Service> element with the following information:

An <xrd:Type> tag whose text content is "http://openid.net/signon/2.0"
An <xrd:URI> tag whose text content is the IdP Endpoint URL
An <openid:Delegate> tag (optional) whose text content is The Delegate Identifier

The "openid" namespace is "http://openid.net/signon/2.0". The "xrd" namespace is "xri://$xrd*($v*2.0)".

For compatibility with deployed code, it is RECOMMENDED that a Relying Party also accept "http://openid.net/signon/1.0" for the value of <xrd:Type>.

If an OpenID IdP supports extensions, the extensions SHOULD be listed as additional <xrd:Type> sub-elements of the <xrd:Service> element.



 TOC 

4.2.3.2.1. XRI and the CanonicalID Element

XXX: There are open issues regarding the CanonicalID and spoofing. Do not implement this subsection of this specification until this note is removed.

When the identifier is an XRI, the XRD that contains the OpenID Service element will also contain a CanonicalID element. The content of this element MUST be preserved for use after a successful authentication request. See Section 8.3 (Identifying the End User).

When using URL-based identifiers, the CanonicalID element SHOULD be ignored.



 TOC 

4.2.4. HTML-Based Discovery

In the interests of backward compatibility, the discovery mechanism from OpenID 1.0 MUST also be supported by a Relying Party. The host of the HTML document is NOT REQUIRED to also be the End User's IdP; the Identifier URL and IdP can be fully decoupled services.

To use OpenID 1.0 discovery, the following markup MUST be added to the HEAD section of the HTML document located at their URL:

A <LINK> tag MUST be included with attributes "rel" set to "openid.server", and "href" set to the IdP's Endpoint URL

A <LINK> tag MAY be included with attributes "rel" set to "openid.delegate" and "href" set to the End User's Delegate Identifier

The "openid.server" and "openid.delegate" URLs MUST NOT include entities other than &amp;, &lt;, &gt;, and &quot;. Other characters that would not be valid in the HTML document or that cannot be represented in the document's character encoding MUST be escaped using the %xx mechanism as described in [RFC3986] (Berners-Lee, T., “Uniform Resource Identifiers (URI): Generic Syntax,” .).



 TOC 

5. Communication Types

The data transferred between the Relying Party and Identity Provider always consists of a mapping of keys to values. Data is transferred between a Relying Party and IdP in two different ways. Either the Relying Party directly connects to the IdP or the Relying Party or server sends data indirectly via the User-Agent.



 TOC 

5.1. Direct Communication

Direct communication between a Relying Party and IdP is accomplished using an HTTP POST (see [RFC2616] (Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, “Hypertext Transfer Protocol -- HTTP/1.1,” .)) initiated by a Relying Party to an IdP endpoint URL.



 TOC 

5.1.1. Direct Request

The body of a direct POST request consists of a mapping of keys to values encoded using a form encoding specified in section 17.13.4 of the HTML 4.01 specification (W3C, “HTML 4.01 Specification,” .) [HTML401]. Likewise, if the "Content-Type" header is included in the request headers, its value MUST also be such an encoding.



 TOC 

5.1.2. Direct Response

The HTTP Status Code of a response to a valid request is 200. If a request is malformed or contains invalid arguments, the HTTP Status Code of the response is 400. If a Relying Party receives a request with a Status Code other than 200 or 400, it is an unrecoverable error. The body of an HTTP POST response to a valid Section 5.1.1 (Direct Request) consists of a mapping of keys to values encoded in Section 5.1.2.1 (Key-Value Form).



 TOC 

5.1.2.1. Key-Value Form

Key-Value Form is a simple data format for representing a mapping from plain-text keys to plain-text values. A Key-Value form message is a sequence of lines, each containing a pair of key and value. No key or value can contain a newline. No key can contain a colon. Each key-value pair is joined with a colon, and then a newline is appended. There MUST NOT be a space before or after the colon. Every line MUST end with a newline, ASCII character 10 ("\n"). The Key-Value form representation of a mapping is the concatenation of all of the lines generated from the pairs in the mapping. If there are any non-ASCII characters in the message, the message MUST be encoded in UTF-8.



 TOC 

5.2. Indirect Communication

Indirect communication between Relying Party and IdP passes a message through the User-Agent. This can be initiated by either the Relying Party or the IdP. Indirect communication allows the messages to be associated with the End User. There are two methods for indirect communication, HTTP redirects and HTML form submission.

Both forms of communication require the sender to know a recipient URL and the recipient URL to expect indirect messages, both as URL query arguments and as HTTP POST messages. The initiator of the communication chooses which method of indirect communication is appropriate. Section 7 (Requesting Authentication) and Section 8 (Responding to Authentication Requests) both take the form of indirect communication.



 TOC 

5.2.1. HTTP Redirect

Data can be transferred by issuing a 302 HTTP Redirect to the End User's User-Agent. The redirect URL is the URL of the receiver with a mapping of keys to values encoded as URL-encoded query parameters and appended to the URL query string.



 TOC 

5.2.2. HTML FORM Redirection

A mapping of keys to values can be transferred by returning an HTML page to the User-Agent that contains an HTML form element. The form method MUST be POST. The action parameter MUST be the URL of the receiving website. Each Key-Value pair MUST be included in the form as an input element. The key should be encoded as the "name" attribute and the value as the "value" attribute. The form MUST include a submit button. Form submission MAY be automated using JavaScript. The encoding of the POST data MUST conform to the encoding requirements in the Direct Request (Direct Request) section.



 TOC 

6. Establishing Associations

An "association" is a set of information that allows a Relying Party to check the cryptographic signature of a response from the IdP. Associations are a relationship between a Relying Party and an IdP. If a Relying Party is incapable of creating or storing associations, OpenID provides a mechanism (Section 8.2.2 (Verifying Signatures)) for authentication to complete securely by using a back-channel between the Relying Party and the server to check the signature on the response instead of using an association. When a Relying Party is operating without creating associations, it is said to be in "stateless mode."

It is RECOMMENDED that a Relying Party form associations if it is possible for it to do so. After the initial request, using an association saves one HTTP request per authentication, which saves network resources and improves performance.



 TOC 

6.1. Generating Signatures

Successful authentication messages from the Identity Provider to the Relying Party MUST be cryptographically signed. The signed information is a subset of the mapping of keys to values as specified in Section 5 (Communication Types). A signed message contains of a list of signed fields, an association handle, and a signature. The algorithm for generating the signature depends on the type of association.

To compute the signature from an association, an ordered list of signed fields and a set of query parameters:

  1. Create an ordered sequence of key-value pairs. Iterate over the list of signed fields in order, taking the field name as the key. For each key, find all values in the query parameters whose key is equal to the field name prefixed with "openid.". The ordering of pairs with the same key SHALL be lexically by the value.
  2. Generate a Key-Value Form string with the pairs in the order that they appear in the sequence of key-value pairs.
  3. Generate the signature by evaluating the keyed message digest function specified by the association on the resulting Key-Value Form string.



 TOC 

6.2. Association Handles

Associations are referred to by a handle, which MUST be a string 255 characters or less, and consist only of ASCII characters in the range 33-126 inclusive (printable non-whitespace characters). The handle is used to look up stored associations. A Relying Party SHOULD re-use the association for a server until it expires or is instructed to stop using it by the IdP.



 TOC 

6.3. Association Types

Associations have a type, indicating the algorithm for computing the signature of messages created with that association. OpenID associations use keyed message digest functions. The key for the message digest function is known as a Message Authentication Code (MAC) key.



 TOC 

6.3.1. HMAC-SHA1 Associations

An association of type HMAC-SHA1 (Eastlake, D. and P. Jones, “US Secure Hash Algorithm 1 (SHA1),” .) [RFC3174] uses the following algorithm to compute a signature of the message:

  HMAC-SHA1(MAC key, token_contents)

HMAC-SHA1 associations have the association type "HMAC-SHA1". The side of the MAC key for HMAC-SHA1 associations is 160 bits.



 TOC 

6.3.2. HMAC-SHA256 Associations

An association of type HMAC-SHA256 (U.S. Department of Commerce/National Institute of Standards and Technology, “US Secure Hash Algorithm 256 (SHA256), FIPS PUB 180-2.,” .) [FIPS180-2] uses the following algorithm to compute a signature of the message:

  HMAC-SHA256(MAC key, token_contents)

HMAC-SHA256 associations have the association type "HMAC-SHA256". The side of the MAC key for HMAC-SHA1 associations is 256 bits.



 TOC 

6.4. Association Sessions

An association session consists of an association request from a Relying Party to the IdP Endpoint URL. An association session is a direct request as specified in Section 5.1 (Direct Communication) with "openid.mode" set to "associate". There are several association session types defined. All association session types have a common parameter, "openid.assoc_type" that indicates the type of the established association.



 TOC 

6.4.1. Request Parameters

These parameters are common to all association requests.



 TOC 

6.4.2. Response Parameters

The format of responses to associate requests is Key-Value pairs (Key-Value Form). All association session responses share the following fields:



 TOC 

6.4.3. Clear-Text Association Sessions

If the IdP's Endpoint URL is an HTTPS URL, a clear-text association session may be used. Clear-text association sessions also allow for Relying Parties or IdPs to be run in environments where there is no support for arbitrary precision arithmetic. In all other cases, clear-text association sessions SHOULD NOT be used.

An IdP MAY respond to an association request with a clear-text association session response regardless of the type of association session requested. For better security, a Relying Party MAY choose not to use the resulting association on subsequent requests.



 TOC 

6.4.3.1. Request Parameters

There are no extra parameters defined for a clear-text association session request. To request a clear-text association, leave blank the "openid.session_type" query parameter on the request.



 TOC 

6.4.3.2. Response Parameters

The response to a Clear-Text association session has the following extra fields:



 TOC 

6.4.4. Diffie-Hellman Association Sessions

OpenID supports two different kinds of associations based on Diffie-Hellman key exchange, "DH-SHA1" and "DH-SHA256". The MAC key MUST be the same length as the output of H, the hash function - 160 bits (20 bytes) for DH-SHA1 or 256 bits (32 bytes) for DH-SHA256.

If the IdP does not support Diffie-Hellman, it MUST ignore the Diffie-Hellman fields in the request and reply with a clear-text association session response. Relying Parties MAY choose to use "stateless mode" in this case.

The Relying Party specifies a modulus, p, and a generator, g. The Relying Party chooses a random private key xa and Identity provider chooses a random private key xb, both in the range [1 .. p-1]. The shared secret used to encrypt the MAC key is thus g ^ (xa * xb) mod p = (g ^ xa) ^ xb mod p = (g ^ xb) ^ xa mod p. For more information, see [RFC2631] (Rescorla, E., “Diffie-Hellman Key Agreement Method,” .).



 TOC 

6.4.4.1. Integer Representations

Arbitrary precision integers MUST be encoded as big-endian signed two's complement binary strings. Henceforth, "btwoc" is a function that takes an arbitrary precision integer and returns its shortest big-endian two's complement representation. All integers that are used with Diffie-Hellman are positive. This means that the left-most bit of the two's complement representation MUST be zero. If it is not, add a zero byte at the front of the string.

Non-normative example:

Base 10 number | btwoc string representation
---------------+----------------------------
0              | "\x00"
127            | "\x7F"
128            | "\x00\x80"
255            | "\x00\xFF"
32768          | "\x00\x80\x00"


 TOC 

6.4.4.2. Request Parameters



 TOC 

6.4.4.3. Response Parameters

dh_server_public

Value: base64(btwoc(g ^ xb mod p))

Description: The Provider's Diffie-Hellman public key.

enc_mac_key

Value: base64(H(btwoc(g ^ (xa * xb) mod p)) XOR MAC key)

Description: The MAC key, encrypted with the secret Diffie-Hellman value. H is either SHA1 or SHA256 depending on the session type.



 TOC 

7. Requesting Authentication

Once the Relying Party has successfully performed discovery and optionally created an association with the discovered server, it can send the End User to the server to obtain an assertion, using one of the mechanisms in Section 5.2 (Indirect Communication).



 TOC 

7.1. Request Parameters



 TOC 

7.2. Trust Roots

A "trust root" is a pattern that represents the part of URL-space for which an OpenID authentication request is valid. A trust root should give the End User an indication of the scope of the authentication request. IdPs SHOULD present the trust root when requesting the End User's approval for an authentication request. IdPs MAY use the trust root to allow the End User to automate approval of authentication requests.

A trust root pattern is a URL, with the following changes:

The "openid.return_to" URL MUST descend from the "openid.trust_root", or the IdP MUST return an error. A URL matches a trust root if:

It is RECOMMENDED that IdP's protect their End Users from requests with overly-general trust roots, like http://*.com/ or http://*.co.uk/. Whether a trust root is overly-general is at the discretion of the IdP.



 TOC 

7.3. Immediate Requests

When requesting authentication, the Relying Party MAY want to request that the IdP not interact with the End User, and instead respond immediately with either an assertion that they can and does want to proceed or a response indicating that the request cannot be completed without further user interaction. This is accomplished by an authentication request with "openid.mode" set to "checkid_immediate".



 TOC 

8. Responding to Authentication Requests

An authentication request comes from the User-Agent. The IdP should identify the User-Agent, through some method of authentication or by browser session state, such as cookies. How the End User authenticates to the IdP is outside of the scope of OpenID Authentication. Once the End User has been identified, the IdP should determine if the End User wishes for this authentication request to complete. This determination is also out of the scope of OpenID Authentication. If the End User wishes for it to complete, the End User has approved authentication, and a positive assertion SHOULD be issued.

Once the End User is known to the IdP, the IdP decides whether to issue an assertion as specified in Section 8.1 (Positive Assertions). If no Identifier was specified and there are Identifiers that are in the control of the End User, the IdP SHOULD allow the End User to choose an identifier to assert control over to the Relying Party. If an Identifier was specified, the IdP SHOULD only issue assertions about the specified Identifier.

In order to make an assertion, the IdP needs to have an association with the Relying Party. If the Relying Party supplied an association handle, the association information SHOULD be looked up based on that handle. If the association is expired or missing, the IdP SHOULD indicate to the Relying Party that the association was invalid by setting the value of "openid.invalidate_handle" to the Relying Party-specified handle. If an invalid association was sent, aside from including the "openid.invalidate_handle" parameter in the response, the IdP should treat the request the same as a request without an association handle specified.

If no association handle is specified, the request is a "stateless mode" request. The IdP will create a private association for signing the response, and will respond to later requests to check the signature of that response.



 TOC 

8.1. Positive Assertions

If the End User approves the authentication, the Identity Provider sends a response back through the User-Agent with the following information as specified in Section 5.2 (Indirect Communication):



 TOC 

8.2. Verifying Assertions

If the Relying Party receives a positive assertion, it MUST verify the following before accepting the assertion:



 TOC 

8.2.1. Verifying Discovered Information

Either the Identifier in the assertion points to the OpenID IdP making the assertion, or the assertion is being made using delegation (Delegating Authentication) and the Identifier with the delegate information points to that IdP, and specifies the identifier in the assertion as a delegate. Specifically, the Relying Party MUST have performed discovery (Discovery) on the Identifier that will be used and the information in the assertion MUST match the discovered information.

To prevent replay attacks, the Relying Party SHOULD keep track of the nonce values included in positive assertions and never accept the same value more than once for the same association. The Relying Party can use the time-stamp to reject responses that are too old, limiting the amount of time that nonces must be stored to prevent replays.



 TOC 

8.2.2. Verifying Signatures

If the Relying Party has stored an association with the association handle specified in the assertion, it MUST check the signature on the assertion itself. If no association is found, it MUST request that the IdP verify the signature.



 TOC 

8.2.2.1. Verifying with an Association

The Relying Party follows the same procedure that the IdP followed in generating the signature (Generating Signatures), and then compares the signature in the response to the signature it generates. If the signatures do not match, the assertion is invalid.



 TOC 

8.2.2.2. Verifying Directly with the Identity Provider

If the association handle is not recognized, the Relying Party MUST attempt to contact the IdP to verify the signature. The Relying Party generates a POST to the IdP Endpoint URL with the signed values from the assertion and the association information. The response to that request indicates whether the signature is correct.

When the IdP is verifying the signature, the "openid.mode" value MUST be changed to "id_res". The "openid.signed" value MUST contain at least the values specified for the "openid.signed" field in an authentication request (Section 8.1 (Positive Assertions)).

An IdP MUST only verify signatures for associations that do not have shared MAC keys. If an IdP did verify signatures for associations with shared MAC keys, it would be possible for parties other than the IdP to create valid assertions that seemed to come from the IdP.

Implementation Note for Stateless Relying Parties: The Relying Party must verify the signature at the same IdP Endpoint from which it was issued. In the event that there are multiple endpoints defined for a Claimed Identifier, this requires the Relying Party to remember the endpoint with whom they are conversing. The Relying Party MAY choose to encode this information in a parameter on the return_to URL it provides in the id_res request. That encoded data MUST be signed to prevent tampering from malicious agents.



 TOC 

8.2.2.2.1. Request Parameters



 TOC 

8.2.2.2.2. Response Parameters

Response format: Key-Value Pairs



 TOC 

8.3. Identifying the End User

OpenID provides the Relying Party with a Verified Identifier, which MAY be used as a user-visible identifier. Except in the case that the Verified Identifier is an XRI, the Relying Party SHOULD use the Verified Identifier as a key for local storage of information about the End User. If the Verified Identifier is an XRI, the discovered CanonicalID field from the XRD SHOULD be used as a key for local storage of information about the End User.

If a request is using delegation, the Verified Identifier is the Identifier on which discovery was performed, and not the identifier that is contained in the assertion. If an assertion is made for an Identifier on which discovery has not been performed, the Relying Party MUST perform discovery on that Identifier and compare the discovered information to that in the assertion.



 TOC 

8.4. Negative Assertions

The IdP sends a response back through the User-Agent if it is unable to identify the End User or the End User does not or cannot approve the request.



 TOC 

8.4.1. In Response to Immediate Requests

If the request was an immediate request, there is no chance for the End User to interact with pages on the IdP to provide identifying credentials or approval of a request. A negative assertion of an immediate request takes the following form:



 TOC 

8.4.2. In Response to Non-Immediate Requests

Since the IdP may display pages to the End User and request credentials from the End User, a negative response to a request that is not immediate is definitive. It takes the following form:

In a lot of cases, the Relying Party won't get a cancel mode; the End User will just quit or press back within their User-Agent. But if it is returned, the Relying Party SHOULD return to what it was doing.



 TOC 

9. Discovering Identity Relying Parties

Relying Parties are RECOMMENDED to use the Yadis protocol to publish their return_to URL. This allows for automated discovery of OpenID Relying Parties.

The Relying Party's XRDS document's <xrd:Service> entry should have the return_to URL as the content of the <xrd:URI> tag and should have http://openid.net/return_to/2.0 as the content of the <xrd:Type> tag.

For example:

<Service xmlns="xri://$xrd*($v*2.0)">
  <Type>http://openid.net/return_to/2.0</Type>
  <URI>http://consumer.example.com/return</URI>
</Service>


 TOC 

10. Security Considerations



 TOC 

11. Examples

Non-normative



 TOC 

11.1. Delegation

For example, an End User wants to use http://www.example.com/ as their Identifier, but http://www.example.com/ doesn't have the means, or desire, to run an IdP. LiveJournal is an Identity Provider, so if the End User has a LiveJournal OpenID Identifier, they can delegate their authentication to LiveJournal.



 TOC 

11.2. XRDS

To use www.example.com as their Identifier, but have Relying Parties actually verify http://exampleuser.livejournal.com/ with the Identity Provider located at http://www.livejournal.com/openid/server.bml, the following XML snippet should be present in the final XRD in the XRDS file:

<Service xmlns="xri://$xrd*($v*2.0)">
  <Type>http://openid.net/signon/2.0</Type>
  <URI>http://www.livejournal.com/openid/server.bml</URI>
  <Delegate xmlns="http://openid.net/signon/2.0">
    http://exampleuser.livejournal.com/
  </Delegate>
</Service>


 TOC 

11.3. HTML Identifier Markup

To use www.example.com as their Identifier, but have Relying Parties actually verify http://exampleuser.livejournal.com/ with the Identity Provider located at http://www.livejournal.com/openid/server.bml, the following markup should be present in the <head> of the HTML document located by the identifier URL:

<link rel="openid.server"
      href="http://www.livejournal.com/openid/server.bml">
<link rel="openid.delegate"
      href="http://exampleuser.livejournal.com/">


 TOC 

11.4. Login Form

Continuing this example, the End User visits a Relying Party site which supports OpenID Authentication. The Relying Party presents the End User with a form field for them to enter their Identifier or their IdP's identifier.

For Example:

              ----------------------------------
              |[logo]example.com               | [Login Button]
              ----------------------------------


 TOC 

11.5. XRI CanonicalID

For example, if =example and =exmpl both yield an XRD document with the CanonicalID xri://(example)!1234 then those identifiers should be treated as equivalent. For applications with user accounts, those identifiers should both be attached to the same account.



 TOC 

12. Extensions

An Extension to OpenID is a protocol that rides on top of the OpenID authentication request and response. A definition of an OpenID Extension consists of the following:

Care should be taken when designing an extension to OpenID, so that the URLs do not exceed the limits imposed by [RFC3986] (Berners-Lee, T., “Uniform Resource Identifiers (URI): Generic Syntax,” .)



 TOC 

Appendix A. Diffie-Hellman Default Value

This is a confirmed-prime number, used as the default modulus for Diffie-Hellman key exchange. In hexadecimal:

DCF93A0B883972EC0E19989AC5A2CE310E1D37717E8D9571BB7623731866E61E
F75A2E27898B057F9891C2E27A639C3F29B60814581CD3B2CA3986D268370557
7D45C2E7E52DC81C7A171876E5CEA74B1448BFDFAF18828EFD2519F14E45E382
6634AF1949E5B535CC829A483B8A76223E5D490A257F05BDFF16F2FB22C583AB


 TOC 

Appendix B. Error Responses

This section pertains to protocol/run-time errors, not authentication errors. Authentication errors are defined in the protocol.



 TOC 

Appendix C. Changes from the Previous OpenID Specification

This specification is based on the original specification for OpenID as written by Brad Fitzpatrick. That specification did not have a version number, but was called OpenID 1.0, and then OpenID 1.1 when it was revised. The protocol outlined in this specification is intended to be backwards-compatible with the revised OpenID protocol. The most significant changes to the specification are outlined in this section.



 TOC 

Appendix C.1. Updated Initiation and Discovery



 TOC 

Appendix C.2. Security improvements

A nonce is now part of the protocol for built-in protection against replay attacks.

A new association type, HMAC-SHA256, and a new association session type, DH-SHA256, allow for stronger signatures on authentication assertions.



 TOC 

Appendix C.3. Extensions

Extensions are a new mechanism to support data exchange and other Relying Party-IdP communication along with the authentication exchange. Extensions allow for the exchange of arbitrary attributes, as well as for protocol extensions, such as the inclusion of additional information about the Relying Party in the authentication request.

Because extensions can transfer arbitrary data, the Identifier is now optional in the response.



 TOC 

13. Normative References

[FIPS180-2] U.S. Department of Commerce/National Institute of Standards and Technology, “US Secure Hash Algorithm 256 (SHA256), FIPS PUB 180-2..”
[HTML401] W3C, “HTML 4.01 Specification.”
[RFC2119] Bradner, B., “Key words for use in RFCs to Indicate Requirement Levels.”
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, “Hypertext Transfer Protocol -- HTTP/1.1.”
[RFC2631] Rescorla, E., “Diffie-Hellman Key Agreement Method.”
[RFC3174] Eastlake, D. and P. Jones, “US Secure Hash Algorithm 1 (SHA1).”
[RFC3986] Berners-Lee, T., “Uniform Resource Identifiers (URI): Generic Syntax.”


 TOC 

Authors' Addresses

  David Recordon
  VeriSign, Inc.
  487 E Middlefield Road
  Mountain View, CA 94109
  USA
Email:  drecordon@verisign.com
  
  Josh Hoyt
  JanRain, Inc.
  5331 SW Macadam Avenue
  Suite #375
  Portland, OR 97239
  USA
Email:  josh@janrain.com
  
  Brad Fitzpatrick
  Six Apart, Ltd.
  548 4th Street
  San Francisco, CA 94107
  USA
Email:  brad@danga.com