Draft N. Sakimura NRI J. Bradley Ping Identity M. Jones Microsoft B. de Medeiros Google C. Mortimore Salesforce October 15, 2013 OpenID Connect Core 1.0 - draft 14 Abstract OpenID Connect 1.0 is a simple identity layer on top of the OAuth 2.0 protocol. It enables Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner. This specification defines the core OpenID Connect functionality: authentication built on top of OAuth 2.0 and the use of Claims to communicate information about the End-User. It also describes the security and privacy considerations for using OpenID Connect. Sakimura, et al. [Page 1] OpenID Connect Core 1.0 October 2013 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1. Requirements Notation and Conventions . . . . . . . . . 7 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . 8 1.3. Overview . . . . . . . . . . . . . . . . . . . . . . . . 11 2. Authentication . . . . . . . . . . . . . . . . . . . . . . . 12 2.1. Authentication using the Authorization Code Flow . . . . 12 2.1.1. Authorization Code Flow Steps . . . . . . . . . . . . 12 2.1.2. Authorization Endpoint . . . . . . . . . . . . . . . 13 2.1.2.1. Authorization Request . . . . . . . . . . . . . . 13 2.1.2.2. Authorization Request Validation . . . . . . . . 17 2.1.2.3. Authorization Server Authenticates End-User . . . 18 2.1.2.4. Authorization Server Obtains End-User Consent/Authorization . . . . . . . . . . . . . . 18 2.1.2.5. Authorization Successful Response . . . . . . . . 19 2.1.2.6. Authorization Error Response . . . . . . . . . . 19 2.1.2.7. Authorization Response Validation . . . . . . . . 21 2.1.3. Token Endpoint . . . . . . . . . . . . . . . . . . . 21 2.1.3.1. Token Request . . . . . . . . . . . . . . . . . . 22 2.1.3.2. Token Request Validation . . . . . . . . . . . . 23 2.1.3.3. Token Successful Response . . . . . . . . . . . . 23 2.1.3.4. Token Error Response . . . . . . . . . . . . . . 24 2.1.3.5. Token Response Validation . . . . . . . . . . . . 25 2.1.3.6. ID Token . . . . . . . . . . . . . . . . . . . . 25 2.1.3.7. ID Token Validation . . . . . . . . . . . . . . . 28 2.1.3.8. Access Token Validation . . . . . . . . . . . . . 30 2.2. Authentication using the Implicit Flow . . . . . . . . . 30 2.2.1. Implicit Flow Steps . . . . . . . . . . . . . . . . . 30 2.2.2. Authorization Endpoint . . . . . . . . . . . . . . . 30 2.2.2.1. Authorization Request . . . . . . . . . . . . . . 31 2.2.2.2. Authorization Request Validation . . . . . . . . 32 2.2.2.3. Authorization Server Authenticates End-User . . . 32 2.2.2.4. Authorization Server Obtains End-User Consent/Authorization . . . . . . . . . . . . . . 32 2.2.2.5. Authorization Successful Response . . . . . . . . 32 2.2.2.6. Authorization Error Response . . . . . . . . . . 33 2.2.2.7. Redirect URI Fragment Handling . . . . . . . . . 33 2.2.2.8. Authorization Response Validation . . . . . . . . 35 2.2.2.9. Access Token Validation . . . . . . . . . . . . . 35 2.2.2.10. ID Token . . . . . . . . . . . . . . . . . . . . 35 2.2.2.11. ID Token Validation . . . . . . . . . . . . . . . 36 2.3. Authentication using the Hybrid Flow . . . . . . . . . . 36 2.3.1. Hybrid Flow Steps . . . . . . . . . . . . . . . . . . 36 2.3.2. Authorization Endpoint . . . . . . . . . . . . . . . 37 2.3.2.1. Authorization Request . . . . . . . . . . . . . . 37 2.3.2.2. Authorization Request Validation . . . . . . . . 38 2.3.2.3. Authorization Server Authenticates End-User . . . 38 Sakimura, et al. [Page 2] OpenID Connect Core 1.0 October 2013 2.3.2.4. Authorization Server Obtains End-User Consent/Authorization . . . . . . . . . . . . . . 38 2.3.2.5. Authorization Successful Response . . . . . . . . 38 2.3.2.6. Authorization Error Response . . . . . . . . . . 39 2.3.2.7. Redirect URI Fragment Handling . . . . . . . . . 39 2.3.2.8. Authorization Response Validation . . . . . . . . 39 2.3.2.9. Access Token Validation . . . . . . . . . . . . . 40 2.3.2.10. Code Validation . . . . . . . . . . . . . . . . . 40 2.3.2.11. ID Token . . . . . . . . . . . . . . . . . . . . 40 2.3.2.12. ID Token Validation . . . . . . . . . . . . . . . 41 2.3.3. Token Endpoint . . . . . . . . . . . . . . . . . . . 41 2.3.3.1. Token Request . . . . . . . . . . . . . . . . . . 41 2.3.3.2. Token Request Validation . . . . . . . . . . . . 42 2.3.3.3. Token Successful Response . . . . . . . . . . . . 42 2.3.3.4. Token Error Response . . . . . . . . . . . . . . 42 2.3.3.5. Token Response Validation . . . . . . . . . . . . 42 2.3.3.6. ID Token . . . . . . . . . . . . . . . . . . . . 42 2.3.3.7. ID Token Validation . . . . . . . . . . . . . . . 42 2.3.3.8. Access Token . . . . . . . . . . . . . . . . . . 43 2.3.3.9. Access Token Validation . . . . . . . . . . . . . 43 3. Initiating Login from a Third Party . . . . . . . . . . . . . 44 4. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.1. Requesting Claims using Scope Values . . . . . . . . . . 45 4.2. Standard Claims . . . . . . . . . . . . . . . . . . . . 46 4.2.1. Address Claim . . . . . . . . . . . . . . . . . . . . 52 4.2.2. Claims Languages and Scripts . . . . . . . . . . . . 53 4.2.3. Claim Stability and Uniqueness . . . . . . . . . . . 54 4.2.4. Additional Claims . . . . . . . . . . . . . . . . . . 54 4.3. UserInfo Endpoint . . . . . . . . . . . . . . . . . . . 54 4.3.1. UserInfo Request . . . . . . . . . . . . . . . . . . 55 4.3.2. UserInfo Successful Response . . . . . . . . . . . . 55 4.3.3. UserInfo Error Response . . . . . . . . . . . . . . . 56 4.3.4. UserInfo Response Validation . . . . . . . . . . . . 57 4.4. Requesting Claims Locales with the "claims_locales" Request Parameter . . . . . . . . . . . . . . . . . . . 57 4.5. Requesting Claims using the "claims" Request Parameter . 57 4.5.1. Individual Claims Requests . . . . . . . . . . . . . 59 4.5.1.1. Requesting the "acr" Claim . . . . . . . . . . . 61 4.5.2. Languages and Scripts for Individual Claims . . . . . 61 4.6. Claim Types . . . . . . . . . . . . . . . . . . . . . . 62 4.6.1. Normal Claims . . . . . . . . . . . . . . . . . . . . 62 4.6.2. Aggregated and Distributed Claims . . . . . . . . . . 62 4.6.2.1. Example of Aggregated Claims . . . . . . . . . . 64 4.6.2.2. Example of Distributed Claims . . . . . . . . . . 64 5. Passing Request Parameters as JWTs . . . . . . . . . . . . . 66 5.1. Passing a Request Object by Value . . . . . . . . . . . 66 5.1.1. Request using the "request" Request Parameter . . . . 68 5.2. Passing a Request Object by Reference . . . . . . . . . 69 Sakimura, et al. [Page 3] OpenID Connect Core 1.0 October 2013 5.2.1. URL Referencing the Request Object . . . . . . . . . 71 5.2.2. Request using the "request_uri" Request Parameter . . 71 5.2.3. Authorization Server Fetches Request Object . . . . . 72 5.2.4. "request_uri" Rationale . . . . . . . . . . . . . . . 72 5.3. Validating JWT-Based Requests . . . . . . . . . . . . . 73 5.3.1. Encrypted Request Object . . . . . . . . . . . . . . 73 5.3.2. Signed Request Object . . . . . . . . . . . . . . . . 73 5.3.3. Request Parameter Assembly and Validation . . . . . . 73 6. Self-Issued OpenID Provider . . . . . . . . . . . . . . . . . 75 6.1. Self-Issued OpenID Provider Discovery . . . . . . . . . 75 6.2. Self-Issued OpenID Provider Registration . . . . . . . . 75 6.2.1. Providing Information with the "registration" Request Parameter . . . . . . . . . . . . . . . . . . 76 6.3. Self-Issued OpenID Provider Request . . . . . . . . . . 76 6.4. Self-Issued OpenID Provider Response . . . . . . . . . . 78 6.5. Self-Issued ID Token Validation . . . . . . . . . . . . 79 7. Subject Identifier Types . . . . . . . . . . . . . . . . . . 81 7.1. Pairwise Identifier Algorithm . . . . . . . . . . . . . 81 8. Client Authentication . . . . . . . . . . . . . . . . . . . . 83 9. Signatures and Encryption . . . . . . . . . . . . . . . . . . 86 9.1. Supported Algorithms . . . . . . . . . . . . . . . . . . 86 9.2. Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 88 9.3. Signing . . . . . . . . . . . . . . . . . . . . . . . . 89 9.3.1. Rotation of Asymmetric Signing Keys . . . . . . . . . 89 9.4. Encryption . . . . . . . . . . . . . . . . . . . . . . . 89 9.4.1. Rotation of Asymmetric Encryption Keys . . . . . . . 90 10. Offline Access . . . . . . . . . . . . . . . . . . . . . . . 92 11. Using Refresh Tokens . . . . . . . . . . . . . . . . . . . . 93 11.1. Refresh Request . . . . . . . . . . . . . . . . . . . . 93 11.2. Refresh Successful Response . . . . . . . . . . . . . . 93 11.3. Refresh Error Response . . . . . . . . . . . . . . . . . 94 12. Serializations . . . . . . . . . . . . . . . . . . . . . . . 95 12.1. Query String Serialization . . . . . . . . . . . . . . . 95 12.2. Form Serialization . . . . . . . . . . . . . . . . . . . 95 12.3. JSON Serialization . . . . . . . . . . . . . . . . . . . 96 13. String Operations . . . . . . . . . . . . . . . . . . . . . . 97 14. Implementation Considerations . . . . . . . . . . . . . . . . 98 14.1. Mandatory to Implement Features for All OpenID Providers . . . . . . . . . . . . . . . . . . . . . . . 98 14.2. Mandatory to Implement Features for Dynamic OpenID Providers . . . . . . . . . . . . . . . . . . . . . . . 99 14.3. Discovery and Registration . . . . . . . . . . . . . . . 99 14.4. Mandatory to Implement Features for Relying Parties . . 100 14.5. Compatibility Notes . . . . . . . . . . . . . . . . . . 100 14.5.1. Pre-Final IETF Specifications . . . . . . . . . . . . 100 14.5.2. Google "iss" Value . . . . . . . . . . . . . . . . . 101 14.6. Related Specifications and Implementer's Guides . . . . 101 15. Security Considerations . . . . . . . . . . . . . . . . . . . 102 Sakimura, et al. [Page 4] OpenID Connect Core 1.0 October 2013 15.1. Request Disclosure . . . . . . . . . . . . . . . . . . . 102 15.2. Server Masquerading . . . . . . . . . . . . . . . . . . 102 15.3. Token Manufacture/Modification . . . . . . . . . . . . . 102 15.4. Access Token Disclosure . . . . . . . . . . . . . . . . 103 15.5. Server Response Disclosure . . . . . . . . . . . . . . . 103 15.6. Server Response Repudiation . . . . . . . . . . . . . . 103 15.7. Request Repudiation . . . . . . . . . . . . . . . . . . 104 15.8. Access Token Redirect . . . . . . . . . . . . . . . . . 104 15.9. Token Reuse . . . . . . . . . . . . . . . . . . . . . . 104 15.10. Eavesdropping or Leaking Authorization Codes (Secondary Authenticator Capture) . . . . . . . . . . . 104 15.11. Token Substitution . . . . . . . . . . . . . . . . . . . 104 15.12. Timing Attack . . . . . . . . . . . . . . . . . . . . . 105 15.13. Other Crypto Related Attacks . . . . . . . . . . . . . . 106 15.14. Signing and Encryption Order . . . . . . . . . . . . . . 106 15.15. Issuer Identifier . . . . . . . . . . . . . . . . . . . 106 15.16. Implicit Grant Flow Threats . . . . . . . . . . . . . . 106 15.17. TLS Requirements . . . . . . . . . . . . . . . . . . . . 106 15.18. Lifetimes of Access Tokens and Refresh Tokens . . . . . 107 15.19. Symmetric Key Entropy . . . . . . . . . . . . . . . . . 107 15.20. Need for Signed Requests . . . . . . . . . . . . . . . . 107 15.21. Need for Encrypted Requests . . . . . . . . . . . . . . 108 16. Privacy Considerations . . . . . . . . . . . . . . . . . . . 109 16.1. Personally Identifiable Information . . . . . . . . . . 109 16.2. Data Access Monitoring . . . . . . . . . . . . . . . . . 109 16.3. Correlation . . . . . . . . . . . . . . . . . . . . . . 109 16.4. Offline Access . . . . . . . . . . . . . . . . . . . . . 109 17. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 111 17.1. JSON Web Token Claims Registry . . . . . . . . . . . . . 111 17.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 111 17.2. OAuth Parameters Registry . . . . . . . . . . . . . . . 114 17.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 114 17.3. OAuth Extensions Error Registry . . . . . . . . . . . . 116 17.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 116 18. References . . . . . . . . . . . . . . . . . . . . . . . . . 118 18.1. Normative References . . . . . . . . . . . . . . . . . . 118 18.2. Informative References . . . . . . . . . . . . . . . . . 121 Appendix A. Authorization Examples . . . . . . . . . . . . . . . 122 A.1. Example using response_type=code . . . . . . . . . . . . 122 A.2. Example using response_type=id_token . . . . . . . . . . 123 A.3. Example using response_type=id_token token . . . . . . . 124 A.4. Example using response_type=code id_token . . . . . . . 125 A.5. Example using response_type=code token . . . . . . . . . 126 A.6. Example using response_type=code id_token token . . . . 126 A.7. RSA Key Used in Examples . . . . . . . . . . . . . . . . 127 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 128 Appendix C. Notices . . . . . . . . . . . . . . . . . . . . . . 130 Appendix D. Document History . . . . . . . . . . . . . . . . . . 131 Sakimura, et al. [Page 5] OpenID Connect Core 1.0 October 2013 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 133 Sakimura, et al. [Page 6] OpenID Connect Core 1.0 October 2013 1. Introduction OpenID Connect 1.0 is a simple identity layer on top of the OAuth 2.0 protocol. It enables Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner. The OpenID Connect Core 1.0 specification defines the core OpenID Connect functionality: authentication built on top of OAuth 2.0 and the use of Claims to communicate information about the End-User. It also describes the security and privacy considerations for using OpenID Connect. As background, the OAuth 2.0 Authorization Framework [RFC6749] and OAuth 2.0 Bearer Token Usage [RFC6750] specifications provide a general framework for third-party applications to obtain and use limited access to HTTP resources. They define mechanisms to obtain and use Access Tokens to access resources but do not define standard methods to provide identity information. Notably, without profiling OAuth 2.0, it is incapable of providing information about the authentication of an End-User. This specification assumes that the Client has already obtained the locations of the OpenID Provider's endpoints, including its Authorization Endpoint and Token Endpoint. These URLs are normally obtained via Discovery, as described in OpenID Connect Discovery 1.0 [OpenID.Discovery], or MAY be obtained via other mechanisms. Likewise, this specification assumes that the Client has already obtained sufficient credentials to interact with the OpenID Provider. These credentials are normally obtained via Dynamic Registration, as described in OpenID Connect Dynamic Client Registration 1.0 [OpenID.Registration], or MAY be obtained via other mechanisms. 1.1. Requirements Notation and Conventions 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 RFC 2119 [RFC2119]. Throughout this document, values are quoted to indicate that they are to be taken literally. When using these values in protocol messages, the quotes MUST NOT be used as part of the value. All uses of JSON Web Signature (JWS) [JWS] and JSON Web Encryption (JWE) [JWE] data structures in this specification utilize the JWS Compact Serialization or the JWE Compact Serialization; the JWS JSON Sakimura, et al. [Page 7] OpenID Connect Core 1.0 October 2013 Serialization and the JWE JSON Serialization are not used. 1.2. Terminology This section defines the terminology used by this specification. This section is a normative portion of this specification, imposing requirements upon implementations. All the capitalized words in the text of this specification, such as "Issuer Identifier", reference these defined terms. Whenever the reader encounters them, their definitions found in this section must be followed. This specification uses the terms "Access Token", "Refresh Token", "Authorization Code", "Authorization Grant", "Authorization Server", "Authorization Endpoint", "Client", "Client Identifier", "Client Secret", "Protected Resource", "Resource Owner", "Resource Server", and "Token Endpoint" defined by OAuth 2.0 [RFC6749], and the terms "Claim Names" and "Claim Values" defined by JSON Web Token (JWT) [JWT]. This specification also defines the following terms: Authentication Process of verifying that an Entity is the owner of an Identity. Typically this involves the verification of the current or past possession of particular credentials, including what the entity knows, possesses, has as physical features, or behaviors, or combinations of these utilizing heuristics. The entity is often an End-User or a Client. Authentication Request An OAuth 2.0 Authorization Request that requests that the End-User be authenticated by the Authorization Server. Authentication Context Information that the Relying Party can require before it makes an entitlement decision with respect to an authentication response. Such context can include, but is not limited to, the actual authentication method used or level of assurance such as ISO/IEC 29115 [ISO29115] entity authentication assurance level. Authentication Context Class Set of authentication methods or procedures that are considered to be equivalent to each other in a particular context. Authentication Context Class Reference Identifier for an Authentication Context Class. Sakimura, et al. [Page 8] OpenID Connect Core 1.0 October 2013 Authorization Code Flow OAuth 2.0 flow in which all tokens are returned from the Token Endpoint. Claim Piece of information asserted about an Entity. Claim Type Syntax used for representing a Claim Value. This specification defines Normal, Aggregated, and Distributed Claim Types. Claims Provider Server that can return Claims about an Entity. Credential Data presented as evidence of the right to use an identity or other resources. End-User Human Resource Owner. Entity Something that has a separate and distinct existence and that can be identified in a context. An End-User is one example of an Entity. Essential Claim Claim specified by the Client as being necessary to ensure a smooth authorization experience for the specific task requested by the End-User. Hybrid Flow OAuth 2.0 flow in which some tokens are returned from the Authorization Endpoint and others are returned from the Token Endpoint. ID Token JSON Web Token (JWT) [JWT] that contains Claims about the authentication event. It MAY contain other Claims. Identifier Value that uniquely characterizes an Entity in a specific context. Identity Set of attributes related to an Entity. Implicit Code Flow OAuth 2.0 flow in which all tokens are returned from the Authorization Endpoint. Issuer Entity that issues a set of Claims. Issuer Identifier Verifiable Identifier for an Issuer. An Issuer Identifier is a case sensitive URL using the "https" scheme that contains scheme, host, and OPTIONALLY, port number and path components and no query or fragment components. Sakimura, et al. [Page 9] OpenID Connect Core 1.0 October 2013 Message Request or a response between an OpenID Relying Party and an OpenID Provider. OpenID Provider (OP) OAuth 2.0 Authorization Server that is capable of providing Claims to a Relying Party about the authentication event and the End-User in an ID Token and/or a UserInfo Endpoint response. OP Endpoints Authorization Endpoint, Token Endpoint, and UserInfo Endpoint. Request Object JWT that contains a set of request parameters as its Claims. Request URI URL that references a resource containing a Request Object. The Request URI contents MUST be retrievable by the Authorization Server. Pairwise Pseudonymous Identifier (PPID) Identifier that identifies the Entity to a Relying Party that cannot be correlated with the Entity's PPID at another Relying Party. Personally Identifiable Information (PII) Information that (a) can be used to identify the natural person to whom such information relates, or (b) is or might be directly or indirectly linked to a natural person to whom such information relates. Relying Party (RP) OAuth 2.0 Client application requiring Claims from an OpenID Provider. Self-Issued OpenID Provider Personal OpenID Provider that issues self-signed ID Tokens. UserInfo Endpoint Protected resource that, when presented with an Access Token by the Client, returns authorized information about the End-User represented by the corresponding Authorization Grant. Validation Process intended to establish the soundness or correctness of a construct. Verification Process intended to test or prove the truth or accuracy of a fact or value. Voluntary Claim Claim specified by the Client as being useful but not Essential for the specific task requested by the End-User. For more background on some of the terminology used, see Internet Security Glossary, Version 2 [RFC4949], ISO/IEC 29115 Entity Sakimura, et al. [Page 10] OpenID Connect Core 1.0 October 2013 Authentication Assurance [ISO29115], and ITU-T X.1252 [X.1252]. 1.3. Overview The OpenID Connect protocol, in abstract, follows the following steps. 1. The RP (Client) sends a request to the OpenID Provider. 2. The OP authenticates the End-User and obtains appropriate authorization. 3. The OP responds with an Access Token and an ID Token. 4. The RP can send a request with the Access Token to the UserInfo Endpoint, per Section 4.3. 5. The UserInfo Endpoint returns Claims about the End-User. Sakimura, et al. [Page 11] OpenID Connect Core 1.0 October 2013 2. Authentication Authentication is performed to log in the End-User or to determine that the End-User is already logged in. Authentication Requests can follow one of three paths: the Authorization Code Flow, the Implicit Flow, or the Hybrid Flow. The Authorization Code Flow is suitable for Clients that can securely maintain a Client Secret between themselves and the Authorization Server whereas, the Implicit Flow is suitable for Clients that cannot. The Hybrid Flow combines aspects of the Authorization Code Flow and the Implicit Flow. The flows determine how the ID Token and Access Token are returned to the Client. The flow used is determined by the "response_type" value contained in the Authorization Request. 2.1. Authentication using the Authorization Code Flow This section describes how to perform authentication using the Authorization Code Flow. When using the Authorization Code Flow, all tokens are returned from the Token Endpoint. The Authorization Code Flow returns an Authorization Code to the Client, which can then exchange it for an Access Token directly. This provides the benefit of not exposing the Access Token to the Resource Owner and possibly other malicious applications with access to the Resource Owner's User-Agent. The Authorization Server can also authenticate the Client before exchanging the Authorization Code for an Access Token. The Authorization Code flow is suitable for Clients that can securely maintain a Client Secret between themselves and the Authorization Server. 2.1.1. Authorization Code Flow Steps The Authorization Code Flow goes through the following steps. 1. Client prepares an Authorization Request containing the desired request parameters. 2. Client sends a request to the Authorization Server. 3. Authorization Server Authenticates the End-User. 4. Authorization Server obtains End-User Consent/Authorization. 5. Authorization Server sends the End-User back to the Client with an Authorization Code. 6. Client requests a response using the Authorization Code at the Token Endpoint. Sakimura, et al. [Page 12] OpenID Connect Core 1.0 October 2013 7. Client receives a response that contains an ID Token and Access Token in the response body. 8. Client validates the tokens and retrieves the End-User's subject identifier. 2.1.2. Authorization Endpoint The Authorization Endpoint performs authentication of the End-User and requests authorization from the End-User to release information to an OpenID Connect Relying Party (Client). When an End-User accesses a Relying Party application that requires the End-User's identity and other information, it sends the User-Agent to the Authorization Server's Authorization Endpoint for authentication and authorization. 2.1.2.1. Authorization Request When the Client wishes to access a Protected Resource and the End- User Authorization has not yet been obtained, the Client prepares an Authorization Request to the Authorization Endpoint. An Authorization Request is a message sent from an RP to the OP's Authorization Endpoint. It is an extended OAuth 2.0 [RFC6749] Authorization Request. Section 4.1.1 and 4.2.1 of OAuth 2.0 [RFC6749] define the OAuth 2.0 Authorization Request parameters. Communication with the Authorization Endpoint MUST utilize TLS. See Section 15.17 for more information on using TLS. Authorization Servers MUST support the use of the HTTP "GET" and "POST" methods defined in RFC 2616 [RFC2616] at the Authorization Endpoint. Clients MAY use the HTTP "GET" or "POST" methods to send the Authorization Request to the Authorization Server. If using the HTTP "GET" method, the request parameters are serialized using URI Query String Serialization, per Section 12.1. If using the HTTP "POST" method, the request parameters are serialized using Form Serialization, per Section 12.2. OpenID Connect uses the following OAuth 2.0 request parameters with the Authorization Code Flow: Sakimura, et al. [Page 13] OpenID Connect Core 1.0 October 2013 scope REQUIRED. OAuth 2.0 scope values. OpenID Connect requests MUST contain the "openid" scope value. Other scope values MAY be present. See Sections 4.1 and 10 for additional scope values defined by this specification. response_type REQUIRED. OAuth 2.0 registered response type value that determines how the Authorization Response is returned to the Client. When using the Authorization Code Flow, this value MUST be "code". client_id REQUIRED. OAuth 2.0 Client Identifier. redirect_uri REQUIRED. Redirection URI to which the response will be sent. This MUST be pre-registered with the OpenID Provider. This URI MUST exactly match one of the "redirect_uris" registered for the Client, with the matching performed as described in Section 6.2.1 of [RFC3986] (Simple String Comparison). When using this flow, the redirection URI MAY use the "http" scheme, provided that the Client Type is "confidential", as defined in Section 2.1 of OAuth 2.0; otherwise, it MUST use the "https" scheme. state RECOMMENDED. Opaque value used to maintain state between the request and the callback. Typically, Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the value of this parameter with the browser cookie. This specification also defines the following request parameters for use with the Authorization Code Flow: nonce OPTIONAL. String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. Sufficient entropy MUST be present in the "nonce" values used to prevent attackers from guessing values. One method to achieve this is to store a random value as a signed session cookie, and pass the value in the "nonce" parameter. In that case, the "nonce" in the returned ID Token can be compared to the signed session cookie to detect ID Token replay by third parties. display OPTIONAL. ASCII string value that specifies how the Authorization Server displays the authentication and consent user interface pages to the End-User. The defined values are: page The Authorization Server SHOULD display authentication and consent UI consistent with a full User-Agent page view. If the display parameter is not specified this is the default display mode. Sakimura, et al. [Page 14] OpenID Connect Core 1.0 October 2013 popup The Authorization Server SHOULD display authentication and consent UI consistent with a popup User-Agent window. The popup User-Agent window SHOULD be 450 pixels wide and 500 pixels tall. touch The Authorization Server SHOULD display authentication and consent UI consistent with a device that leverages a touch interface. The Authorization Server MAY attempt to detect the touch device and further customize the interface. wap The Authorization Server SHOULD display authentication and consent UI consistent with a "feature phone" type display. prompt OPTIONAL. Space delimited, case sensitive list of ASCII string values that specifies whether the Authorization Server prompts the End-User for reauthentication and consent. The defined values are: none The Authorization Server MUST NOT display any authentication or consent user interface pages. A "login_required" error is returned if the End-User is not already authenticated or the Client does not have pre-configured consent for the requested Claims or does not fulfill other conditions for processing. This can be used as a method to check for existing authentication and/or consent. login The Authorization Server SHOULD prompt the End-User for reauthentication. If it cannot prompt the End-User, it MUST return an error. consent The Authorization Server SHOULD prompt the End-User for consent before returning information to the Client. select_account The Authorization Server SHOULD prompt the End- User to select a user account. This enables an End-User who has multiple accounts at the Authorization Server to select amongst the multiple accounts that they might have current sessions for. If it cannot prompt the End-User, it MUST return an error. The "prompt" parameter can be used by the Client to make sure that the End-User is still present for the current session or to bring attention to the request. If this parameter contains "none" with any other value, an error is returned. Sakimura, et al. [Page 15] OpenID Connect Core 1.0 October 2013 max_age OPTIONAL. Maximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated. If the elapsed time is greater than this value, the OP MUST attempt to actively re-authenticate the End-User. (The "max_age" request parameter corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] "max_auth_age" request parameter.) When "max_age" is used, the ID Token returned MUST include an "auth_time" Claim Value. ui_locales OPTIONAL. End-User's preferred languages and scripts for the user interface, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, the value "fr-CA fr en" represents a preference for French as spoken in Canada, then French (without a region designation), followed by English (without a region designation). An error SHOULD NOT result if some or all of the requested locales are not supported by the OpenID Provider. id_token_hint OPTIONAL. Previously issued ID Token passed to the Authorization Server as a hint about the End-User's current or past authenticated session with the Client. If the End-User identified by the ID Token is logged in or is logged in by the request, then the Authorization Server returns a positive response; otherwise, it SHOULD return a "login_required" error. When possible, an "id_token_hint" SHOULD be present when "prompt=none" is used and an "invalid_request" error MAY be returned if it is not; however, the server SHOULD respond successfully when possible, even if it is not present. The Authorization Server need not be listed as an audience of the ID Token when it is used as an "id_token_hint" value. If the ID Token received by the RP is encrypted, the Client MUST decrypt the signed ID Token contained within the encrypted ID Token. The Client MAY re-encrypt the signed ID token to the Authentication Server using a key that enables the server to decrypt the ID Token. login_hint OPTIONAL. Hint to the Authorization Server about the login identifier the End-User might use to log in (if necessary). This hint can be used by an RP if it first asks the End-User for their e-mail address (or other identifier) and then wants to pass that value as a hint to the discovered authorization service. It is RECOMMENDED that the hint value match the value used for discovery. This value MAY also be a phone number in the format specified for the "phone_number" Claim. The use of this parameter is left to the OP's discretion. Sakimura, et al. [Page 16] OpenID Connect Core 1.0 October 2013 acr_values OPTIONAL. Requested Authentication Context Class Reference values. Space-separated string that specifies the "acr" values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as the "acr" Claim Value, as specified in Section 2.1.3.6. The "acr" Claim is requested as a Voluntary Claim by this parameter. Other parameters MAY be sent. See Sections 2.2.2, 2.3.2, 4.4, 4.5, 5, and 6.2.1 for additional Authorization Request parameters and parameter values defined by this specification. The following is a non-normative example request using this flow (with line wraps within values for display purposes only): GET /authorize? response_type=code &scope=openid%20profile%20email &client_id=s6BhdRkqt3 &state=af0ifjsldkj &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb HTTP/1.1 Host: server.example.com 2.1.2.2. Authorization Request Validation The Authorization Server MUST validate the request received as follows: 1. The Authorization Server MUST validate all the OAuth 2.0 parameters according to the OAuth 2.0 specification. 2. The Authorization Server MUST verify that all the REQUIRED parameters are present. 3. If the "sub" (subject) Claim is requested with a specific value for the ID Token, the Authorization Server MUST only send a positive response if that user has an active session with the Authorization Server. The Authorization Server MUST NOT reply with an ID Token or Access Token for a different user, even if they have an active session with the Authorization Server. Such a request can be made either using an "id_token_hint" parameter or by requesting a specific Claim value as described in Section 4.5.1, if the "claims" parameter is supported by the implementation. As specified in OAuth 2.0 [RFC6749], Authorization Servers SHOULD ignore unrecognized request parameters. Sakimura, et al. [Page 17] OpenID Connect Core 1.0 October 2013 If the Authorization Server encounters any error, it MUST return an error response. 2.1.2.3. Authorization Server Authenticates End-User The Authorization Server validates the request to ensure all REQUIRED parameters are present and all parameters are valid. If the request is valid, the Authorization Server attempts to log in the End-User or determines whether he is logged in, depending upon the request parameter values used. The methods used by the Authorization Server to log in the End-User (e.g. username and password, session cookies, etc.) are beyond the scope of this specification. An authentication user interface MAY be displayed by the Authorization Server, depending upon the request parameter values used and the authentication methods used. The Authorization Server MUST attempt to log in the End-User in the following cases: o The End-User is not already logged in. o The Authorization Request contains the "prompt" parameter with the value "login". In this case, the Authorization Server MUST reauthenticate the End-User even if the End-User is already authenticated. The Authorization Server MUST NOT interact with the End-User in the following case: o The Authorization Request contains the "prompt" parameter with the value "none". In this case, the Authorization Server MUST return a "login_required" error if the End-User is not already logged in or could not be silently logged in. The Authorization Server MUST employ appropriate measures against Cross-Site Request Forgery and Clickjacking as, described in Sections 10.12 and 10.13 of OAuth 2.0 [RFC6749]. 2.1.2.4. Authorization Server Obtains End-User Consent/Authorization Once the End-User is authenticated, the Authorization Server MUST obtain an authorization decision. When permitted by the request parameters used, this MAY be done through an interactive dialogue with the End-User that makes it clear what is being consented to or by establishing consent via conditions for processing or other means (for example, via previous administrative consent). The Authorization Server MUST employ countermeasures against Cross- Sakimura, et al. [Page 18] OpenID Connect Core 1.0 October 2013 Site Request Forgery and Clickjacking when interacting with the End- User. 2.1.2.5. Authorization Successful Response Once the authorization is determined, the Authorization Server returns a successful or error response. This section describes the successful response. Section 2.1.2.6 describes the error response. An Authorization Response is a message returned from the OP's Authorization Endpoint in response to the Authorization Request by the RP. Response parameters are returned to the Client by adding them to the "redirect_uri" specified in the Authorization Request using the "application/x-www-form-urlencoded" format. This specification only describes OAuth 2.0 Bearer Token Usage [RFC6750]. The OAuth 2.0 response parameter "token_type" MUST be set to "Bearer" unless another Token Type has been negotiated with the Client. When using the Authorization Code Flow, the Authorization Response MUST return the parameters defined in Section 4.1.2 of OAuth 2.0 [RFC6749]. The following is a non-normative example successful response using this flow (with line wraps within values for display purposes only): HTTP/1.1 302 Found Location: https://client.example.org/cb? code=SplxlOBeZQQYbYS6WxSbIA &state=af0ifjsldkj 2.1.2.6. Authorization Error Response If the End-User denies the request or the End-User authentication fails, the OP (Authorization Server) informs the RP (Client) by using the Error Response parameters defined in Sections 4.1.2.1 of OAuth 2.0 [RFC6749]. The Authorization Server returns the Client to the redirection URI specified in the Authorization Request with the appropriate error parameters. No other parameters SHOULD be returned. In addition to the error codes defined in Sections 4.1.2.1 and 4.2.2.1 of OAuth 2.0, this specification also defines the following error codes: Sakimura, et al. [Page 19] OpenID Connect Core 1.0 October 2013 interaction_required The Authorization Server requires End-User interaction of some form to proceed. This error MAY be returned when the "prompt" parameter in the Authorization Request is set to "none" to request that the Authorization Server MUST NOT display any user interfaces to the End-User, but the Authorization Request cannot be completed without displaying a user interface for End- User interaction. login_required The Authorization Server requires End-User authentication. This error MAY be returned when the "prompt" parameter in the Authorization Request is set to "none" to request that the Authorization Server MUST NOT display any user interfaces to the End-User, but the Authorization Request cannot be completed without displaying a user interface for user authentication. session_selection_required The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the "prompt" parameter in the Authorization Request is set to "none" to request that the Authorization Server MUST NOT display any user interfaces to the End-User, but the Authorization Request cannot be completed without displaying a user interface to prompt for a session to use. consent_required The Authorization Server requires End-User consent. This error MAY be returned when the "prompt" parameter in the Authorization Request is set to "none" to request that the Authorization Server MUST NOT display any user interfaces to the End-User, but the Authorization Request cannot be completed without displaying a user interface for End-User consent. invalid_request_uri The "request_uri" in the Authorization Request returns an error or contains invalid data. invalid_request_object The "request" parameter contains an invalid Request Object. request_not_supported The OP does not support use of the "request" parameter. request_uri_not_supported The OP does not support use of the "request_uri" parameter. Sakimura, et al. [Page 20] OpenID Connect Core 1.0 October 2013 registration_not_supported The OP does not support use of the "registration" parameter. The error response parameters are the following: error REQUIRED. Error code. error_description OPTIONAL. Human-readable ASCII encoded text description of the error. error_uri OPTIONAL. URI of a web page that includes additional information about the error. state OAuth 2.0 state value. REQUIRED if the Authorization Request included the "state" parameter. Set to the value received from the Client. When using the Authorization Code Flow, the response parameters are added to the query component of the redirection URI. The following is a non-normative example error response using this flow (with line wraps within values for display purposes only): HTTP/1.1 302 Found Location: https://client.example.org/cb? error=invalid_request &error_description= the%20request%20is%20not%20valid%20or%20malformed &state=af0ifjsldkj 2.1.2.7. Authorization Response Validation When using the Authorization Code Flow, the Client MUST validate the response according to RFC 6749, especially Sections 4.1.2 and 10.12. 2.1.3. Token Endpoint When using the Authorization Code Flow, the RP (Client) sends a Token Request to the Token Endpoint to obtain a Token Response, which includes an ID Token and an Access Token and MAY include a Refresh Token and other results. Clients MUST use the HTTP "POST" method to make requests to the Token Endpoint. Request parameters are added using Form Serialization, per Section 12.2. The Token Endpoint MUST support the use of the HTTP "POST" method defined in RFC 2616 [RFC2616] at the Token Endpoint. Communication with the Token Endpoint MUST utilize TLS. See Sakimura, et al. [Page 21] OpenID Connect Core 1.0 October 2013 Section 15.17 for more information on using TLS. All Token Endpoint responses that contain tokens, secrets, or other sensitive information MUST include the following HTTP response header fields and values: +---------------+--------------+ | Header Name | Header Value | +---------------+--------------+ | Cache-Control | no-store | | | | | Pragma | no-cache | +---------------+--------------+ HTTP Response Headers and Values Clients MAY provide authentication parameters in the request to the Token Endpoint, as described in Section 8. 2.1.3.1. Token Request A Client using the Authorization Code Flow obtains an ID Token and an Access Token by authenticating with the Authorization Server and presenting its Authorization Grant (in the form of an Authorization Code) to the Token Endpoint. To obtain an ID Token, Access Token, or Refresh Token, the Client MUST authenticate to the Token Endpoint using the authentication method registered for its "client_id", as described in Section 8. The Client sends the parameters via HTTPS "POST" to the Token Endpoint using Form Serialization, per Section 12.2, as described in Section 4.1.3 of OAuth 2.0 [RFC6749]. The following is a non-normative example of a Token Request (with line wraps within values for display purposes only): POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW grant_type=authorization_code&code=SplxlOBeZQQYbYS6WxSbIA &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb Sakimura, et al. [Page 22] OpenID Connect Core 1.0 October 2013 2.1.3.2. Token Request Validation Upon receipt of the request, the Authorization Server MUST: o Authenticate any Clients that were issued Client Credentials (or for which other Client Authentication methods can be used), o Ensure the Authorization Code was issued to the authenticated Client, o Verify that the Authorization Code is valid, and o Ensure that the "redirect_uri" parameter value is identical to the "redirect_uri" parameter value that was included in the initial Authorization Request. If the "redirect_uri" parameter value is not present when there is only one registered "redirect_uri" value, the Authorization Server MAY return an error (since the Client should have included the parameter) or MAY proceed without an error (since OAuth 2.0 permits the parameter to be omitted in this case). 2.1.3.3. Token Successful Response Upon receipt of the Token Request, the Authorization Server MUST return either a successful response or an error response that corresponds to the received Authorization Code. After receiving and validating a valid and authorized Token Request from the Client, the Authorization Server returns a successful response that includes an ID Token and an Access Token. The parameters in the successful response are defined in Section 4.1.4 of OAuth 2.0 [RFC6749]. This specification only describes OAuth 2.0 Bearer Token Usage [RFC6750]. The OAuth 2.0 response parameter "token_type" MUST be set to "Bearer" unless another Token Type has been negotiated with the Client. Servers SHOULD support OAuth 2.0 Bearer Token Usage [RFC6750] for interoperability. For security reasons, Servers MAY only allow Clients to register specific "token_type" values. Clients MUST support OAuth 2.0 Bearer Token Usage [RFC6750] and MAY support other "token_type". In addition to the OAuth 2.0 response parameters, the following parameters MUST be included in the response if the "grant_type" value is "authorization_code" and the Authorization Request "scope" parameter contains "openid": Sakimura, et al. [Page 23] OpenID Connect Core 1.0 October 2013 id_token ID Token value associated with the authenticated session. An "id_token" MUST be returned when the "grant_type" value is "authorization_code" and MAY be returned when other grant types are used. A successful response uses the "application/json" media type. The following is a non-normative example of a successful Token Response: HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-store Pragma: no-cache { "access_token": "SlAV32hkKG", "token_type": "Bearer", "refresh_token": "8xLOxBtZp8", "expires_in": 3600, "id_token": "eyJhbGciOiJSUzI1NiJ9.ew0KICAgICJpc3MiOiAiaHR0cDovL 3NlcnZlci5leGFtcGxlLmNvbSIsDQogICAgInVzZXJfaWQiOiAiMjQ4Mjg5NzYxM DAxIiwNCiAgICAiYXVkIjogInM2QmhkUmtxdDMiLA0KICAgICJub25jZSI6ICJuL TBTNl9XekEyTWoiLA0KICAgICJleHAiOiAxMzExMjgxOTcwLA0KICAgICJpYXQiO iAxMzExMjgwOTcwDQp9.lsQI_KNHpl58YY24G9tUHXr3Yp7OKYnEaVpRL0KI4szT D6GXpZcgxIpkOCcajyDiIv62R9rBWASV191Akk1BM36gUMm8H5s8xyxNdRfBViCa xTqHA7X_vV3U-tSWl6McR5qaSJaNQBpg1oGPjZdPG7zWCG-yEJC4-Fbx2FPOS7-h 5V0k33O5Okd-OoDUKoFPMd6ur5cIwsNyBazcsHdFHqWlCby5nl_HZdW-PHq0gjzy JydB5eYIvOfOHYBRVML9fKwdOLM2xVxJsPwvy3BqlVKc593p2WwItIg52ILWrc6A tqkqHxKsAXLVyAoVInYkl_NDBkCqYe2KgNJFzfEC8g" } As specified in OAuth 2.0 [RFC6749], Clients SHOULD ignore unrecognized response parameters. 2.1.3.4. Token Error Response If the Token Request is invalid or unauthorized, the Authorization Server constructs the error response. The parameters of the Token Error Response are defined as in Section 5.2 of OAuth 2.0 [RFC6749]. The HTTP response body uses the "application/json" media type with HTTP response code of 400. Sakimura, et al. [Page 24] OpenID Connect Core 1.0 October 2013 The following is a non-normative example Token Error Response: HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache { "error": "invalid_request" } 2.1.3.5. Token Response Validation The Client MUST validate the Token Response as follows: 1. Follow the validation rules in RFC 6749, especially those in Sections 5.1 and 10.12. 2. Follow the ID Token validation rules in Section 2.1.3.7. 3. Follow the Access Token validation rules in Section 2.1.3.8. 2.1.3.6. ID Token The ID Token is a security token that contains Claims about the authentication event and other requested Claims. The ID Token is represented as a JSON Web Token (JWT) [JWT]. The ID Token is used to manage the authentication event and user identifier and is scoped to a particular Client via the "aud" (audience) and "nonce" Claims. The following Claims are used within the ID Token when using this flow: iss REQUIRED. Issuer Identifier for the Issuer of the response. The "iss" value is a case sensitive URL using the "https" scheme that contains scheme, host, and OPTIONALLY, port number and path components and no query or fragment components. sub REQUIRED. Subject identifier. A locally unique and never reassigned identifier within the Issuer for the End-User, which is intended to be consumed by the Client, e.g., "24400320" or "AItOawmwtWwcT0k51BayewNvutrJUqsvl6qs7A4". It MUST NOT exceed 255 ASCII characters in length. The "sub" value is a case sensitive string. Sakimura, et al. [Page 25] OpenID Connect Core 1.0 October 2013 aud REQUIRED. Audience(s) that this ID Token is intended for. It MUST contain the OAuth 2.0 "client_id" of the Relying Party as an audience value. It MAY also contain identifiers for other audiences. In the general case, the "aud" value is an array of case sensitive strings. In the special case when there is one audience, the "aud" value MAY be a single case sensitive string. exp REQUIRED. Expiration time on or after which the ID Token MUST NOT be accepted for processing. The processing of this parameter requires that the current date/time MUST be before the expiration date/time listed in the value. Implementers MAY provide for some small leeway, usually no more than a few minutes, to account for clock skew. The time is represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time. See RFC 3339 [RFC3339] for details regarding date/times in general and UTC in particular. The "exp" value is a number. iat REQUIRED. Time at which the JWT was issued. The time is represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time. The "iat" value is a number. auth_time OPTIONAL or REQUIRED. Time when the End-User authentication occurred. The time is represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/ time. When a "max_age" request is made or when "auth_time" is requested as an Essential Claim, then this Claim is REQUIRED. (The "auth_time" Claim semantically corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] "auth_time" response parameter.) The "auth_time" value is a number. nonce OPTIONAL or REQUIRED. String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. If present in the ID Token, Clients MUST verify that the "nonce" Claim Value is equal to the value of the "nonce" parameter sent in the Authorization Request. If present in the Authorization Request, Authorization Servers MUST include a "nonce" Claim in the ID Token with the Claim Value being the nonce value sent in the Authorization Request. Authorization Servers SHOULD perform no other processing on "nonce" values used. Use of the nonce is REQUIRED for all requests where an ID Token is returned directly from the Authorization Endpoint. It is OPTIONAL when the ID Token is returned from the Token Endpoint. The "nonce" value is a case sensitive string. Sakimura, et al. [Page 26] OpenID Connect Core 1.0 October 2013 at_hash OPTIONAL. Access Token hash value. Its value is the base64url encoding of the left-most half of the hash of the octets of the ASCII representation of the "access_token" value, where the hash algorithm used is the hash algorithm used in the "alg" parameter of the ID Token's JWS [JWS] header. For instance, if the "alg" is "RS256", hash the "access_token" value with SHA-256, then take the left-most 128 bits and base64url encode them. The "at_hash" value is a case sensitive string. acr OPTIONAL. Authentication Context Class Reference. String specifying an Authentication Context Class Reference value that identifies the Authentication Context Class that the authentication performed satisfied. The value "0" indicates the End-User authentication did not meet the requirements of ISO/IEC 29115 [ISO29115] level 1. Authentication using a long-lived browser cookie, for instance, is one example where the use of "level 0" is appropriate. Authentications with level 0 SHOULD never be used to authorize access to any resource of any monetary value. (This corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] "nist_auth_level" 0.) An absolute URI or a registered name [RFC6711] SHOULD be used as the "acr" value; registered names MUST NOT be used with a different meaning than that which is registered. Parties using this claim will need to agree upon the meanings of the values used, which may be context-specific. The "acr" value is a case sensitive string. amr OPTIONAL. Authentication Methods References. JSON array of strings that are identifiers for authentication methods used in the authentication. For instance, values might indicate that both password and OTP authentication methods were used. The definition of particular values to be used in the "amr" Claim is beyond the scope of this specification. Parties using this claim will need to agree upon the meanings of the values used, which may be context-specific. The "amr" value is an array of case sensitive strings. azp OPTIONAL or REQUIRED. Authorized Party - the party to which the ID Token was issued. If present, it MUST contain the OAuth 2.0 "client_id" of this party. This Claim is only REQUIRED when the ID Token has a single audience value and that audience is different than the Authorized Party. It MAY be included even when the Authorized Party is the same as the sole audience. The "azp" value is a case sensitive string containing a StringOrURI value. ID Tokens MAY contain other Claims. Any Claims used that are not understood MUST be ignored. See Sections 2.3.2.11, 4.2, and 6.4 for additional Claims defined by this specification. Sakimura, et al. [Page 27] OpenID Connect Core 1.0 October 2013 ID Tokens MUST be signed using JWS [JWS] and OPTIONALLY both signed and then encrypted using JWS [JWS] and JWE [JWE] respectively, thereby providing authentication, integrity, non-repudiation, and optionally, confidentiality, per Section 15.14. ID Tokens MUST NOT use "none" as the "alg" value unless the Authorization Request used the Authorization Code Flow and the Client explicitly requested the use of "none" at registration time. ID Tokens SHOULD NOT use the JWS or JWE "x5u", "x5c", "jku", or "jwk" header parameter fields. Instead, key values and key references used for ID Tokens are communicated in advance using Discovery and Registration parameters. The following is a non-normative example of an ID Token claims set: { "iss": "https://server.example.com", "sub": "24400320", "aud": "s6BhdRkqt3", "nonce": "n-0S6_WzA2Mj", "exp": 1311281970, "iat": 1311280970, "auth_time": 1311280969, "acr": "urn:mace:incommon:iap:silver", "at_hash": "MTIzNDU2Nzg5MDEyMzQ1Ng" } 2.1.3.7. ID Token Validation Clients MUST validate the ID Token in the Token Response, in the following manner: 1. If the Client has provided an "id_token_encrypted_response_alg" parameter during Registration, decrypt the ID Token using the key pair specified during Registration. 2. The Client MUST validate that the "aud" (audience) Claim contains its "client_id" value registered at the Issuer identified by the "iss" (issuer) Claim as an audience. The "aud" (audience) Claim MAY contain an array with more than one element. The ID Token MUST be rejected if the ID Token does not list the Client as a valid audience, or if it contains additional audiences not trusted by the Client. 3. If the ID Token contains multiple audiences, the Client SHOULD verify that an "azp" Claim is present. Sakimura, et al. [Page 28] OpenID Connect Core 1.0 October 2013 4. If an "azp" (authorized party) Claim is present, the Client SHOULD verify and that its "client_id" is the Claim value. 5. If the "id_token" is received via direct communication between the Client and the Token Endpoint, the TLS server validation MAY be used to validate the issuer in place of checking the token signature. The Client MUST validate the signature of all other ID Tokens according to JWS [JWS] using the algorithm specified in the "alg" parameter of the JWT header. 6. The "alg" value SHOULD be the default of "RS256" or the algorithm sent by the Client in the "id_token_signed_response_alg" parameter during Registration. 7. If the "alg" parameter of the JWT header is a MAC based algorithm such as "HS256", "HS384", or "HS512", the octets of the UTF-8 representation of the "client_secret" corresponding to the "client_id" contained in the "aud" (audience) Claim are used as the key to validate the signature. Multiple audiences are not supported for MAC based algorithms. 8. For other Signing algorithms, the Client MUST use the signing key provided in Discovery by the Issuer. The issuer MUST exactly match the value of the "iss" (issuer) Claim. 9. The current time MUST be less than the value of the "exp" Claim. 10. The "iat" Claim can be used to reject tokens that were issued too far away from the current time, limiting the amount of time that nonces need to be stored to prevent attacks. The acceptable range is Client specific. 11. If a nonce value was sent in the Authorization Request, a "nonce" Claim MUST be present and its value checked to verify that it is the same value as the one that was sent in the Authorization Request. The Client SHOULD check the "nonce" value for replay attacks. The precise method for detecting replay attacks is Client specific. 12. If the "acr" Claim was requested, the Client SHOULD check that the asserted Claim Value is appropriate. The meaning and processing of "acr" Claim Values is out of scope for this specification. 13. If the "auth_time" Claim was requested, either through a specific request for this Claim or by using the "max_age" parameter, the Client SHOULD check the "auth_time" Claim value and request re-authentication if it determines too much time has Sakimura, et al. [Page 29] OpenID Connect Core 1.0 October 2013 elapsed since the last End-User authentication. 2.1.3.8. Access Token Validation When using the Authorization Code Flow, if the ID Token contains an "at_hash" Claim, the Client MAY use it to validate the Access Token the same manner as for the Implicit Flow, as defined in Section 2.2.2.9. 2.2. Authentication using the Implicit Flow This section describes how to perform authentication using the Implicit Flow. When using the Implicit Flow, all tokens are returned from the Authorization Endpoint; the Token Endpoint is not used. The Implicit Flow is mainly used by Clients implemented in a browser using a scripting language. The Access Token and ID Token are returned directly to the Client, which may expose them to the Resource Owner and other applications that have access to the Resource Owner's User-Agent. The Authorization Server does not perform Client Authentication before issuing the Access Token. 2.2.1. Implicit Flow Steps The Implicit Flow follows the following steps: 1. Client prepares an Authorization Request containing the desired request parameters. 2. Client sends a request to the Authorization Server. 3. Authorization Server Authenticates the End-User. 4. Authorization Server obtains End-User Consent/Authorization. 5. Authorization Server sends the End-User back to the Client with an ID Token and, if requested, an Access Token. 6. Client validates the tokens and retrieves the End-User's subject identifier. 2.2.2. Authorization Endpoint When using the Implicit Flow, the Authorization Endpoint is used in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2, with the exception of the differences specified in this section. Sakimura, et al. [Page 30] OpenID Connect Core 1.0 October 2013 2.2.2.1. Authorization Request When using the Implicit Flow, Authorization Requests are made in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2.1, with the exception of the differences specified in this section. When using the Implicit Flow, the same Authorization Request parameters are used as for the Code Flow, as defined in Section 2.1.2, with the exception of the differences specified in this section. response_type REQUIRED. OAuth 2.0 registered response type value that determines how the Authorization Response is returned to the Client. When using the Implicit Flow, this value MUST be "id_token token" or "id_token". The meanings of both of these values are defined in OAuth 2.0 Multiple Response Type Encoding Practices [OAuth.Responses]. No Access Token is returned when the value is "id_token". (Note that while OAuth 2.0 also defines the "token" response type value for the Implicit Flow, OpenID Connect does not use this response type, since no ID Token is returned.) redirect_uri REQUIRED. Redirection URI to which the response will be sent. This MUST be pre-registered with the OpenID Provider. This URI MUST exactly match one of the "redirect_uris" registered for the Client, with the matching performed as described in Section 6.2.1 of [RFC3986] (Simple String Comparison). When using this flow, the redirection URI MUST NOT use the "http" scheme unless the Client is a native application, in which case it MAY use the "http:" scheme with "localhost" as the hostname. nonce REQUIRED. String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. Sufficient entropy MUST be present in the "nonce" values used to prevent attackers from guessing values. One method to achieve this is to store a random value as a signed session cookie, and pass the value in the "nonce" parameter. In that case, the "nonce" in the returned ID Token can be compared to the signed session cookie to detect ID Token replay by third parties. Sakimura, et al. [Page 31] OpenID Connect Core 1.0 October 2013 The following is a non-normative example request using the Implicit Flow (with line wraps within values for display purposes only): GET /authorize? response_type=id_token%20token &client_id=s6BhdRkqt3 &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb &scope=openid%20profile &state=af0ifjsldkj &nonce=n-0S6_WzA2Mj HTTP/1.1 Host: server.example.com 2.2.2.2. Authorization Request Validation When using the Implicit Flow, the Authorization Request is validated in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2.2. 2.2.2.3. Authorization Server Authenticates End-User When using the Implicit Flow, End-User Authentication is performed in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2.3. 2.2.2.4. Authorization Server Obtains End-User Consent/Authorization When using the Implicit Flow, End-User Consent is obtained in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2.4. 2.2.2.5. Authorization Successful Response When using the Implicit Flow, Authorization Responses are made in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2.5, with the exception of the differences specified in this section. When using the Implicit Flow, all response parameters are added to the fragment component of the redirection URI, as specified in OAuth 2.0 Multiple Response Type Encoding Practices [OAuth.Responses]. These parameters are returned: access_token Access Token for the UserInfo Endpoint. This is returned unless the "response_type" value used is "id_token". Sakimura, et al. [Page 32] OpenID Connect Core 1.0 October 2013 token_type OAuth 2.0 Token Type value. The value MUST be "Bearer" or another "token_type" value that the Client has negotiated with the Authorization Server. Clients implementing this profile MUST support the OAuth 2.0 Bearer Token Usage [RFC6750] specification. This profile only describes the use of bearer tokens. This is returned in the same cases as "access_token" is. id_token REQUIRED. ID Token. state OAuth 2.0 state value. REQUIRED if the "state" parameter is present in the Client Authorization Request. Clients MUST verify that the "state" value is equal to the value of "state" parameter in the Authorization Request. expires_in OPTIONAL. Expiration time of the Access Token in seconds since the response was generated. The following is a non-normative example of a successful response using the Implicit Flow (with line wraps for the display purposes only): HTTP/1.1 302 Found Location: https://client.example.org/cb# access_token=SlAV32hkKG &token_type=bearer &id_token=eyJ0 ... NiJ9.eyJ1c ... I6IjIifX0.DeWt4Qu ... ZXso &expires_in=3600 &state=af0ifjsldkj 2.2.2.6. Authorization Error Response When using the Implicit Flow, Authorization Error Responses are made in the same manner as for the Authorization Code Flow, as defined in Section 2.1.2.6, with the exception of the differences specified in this section. If the End-User denies the request or the End-User authentication fails, the Authorization Server MUST return the error Authorization Response as defined in 4.2.2.1 of OAuth 2.0 [RFC6749] and OAuth 2.0 Multiple Response Type Encoding Practices [OAuth.Responses]. In particular, error parameters are returned in the fragment component of the redirection URI. 2.2.2.7. Redirect URI Fragment Handling The Client MUST provide a way for the User-Agent to parse the fragment encoded response and post it to the Web Server Client for validation. Sakimura, et al. [Page 33] OpenID Connect Core 1.0 October 2013 The following is an example of a JavaScript file that a Client might host at its "redirect_uri". This is loaded by the redirect from the Authorization Server. The fragment component is parsed and then sent by "POST" to a URI that will validate the information received. Following is a non-normative example of a Redirect URI response: GET /cb HTTP/1.1 Host: client.example.org HTTP/1.1 200 OK Content-Type: text/html