Você está na página 1de 44
RFC6749 From RFC-Wiki Forga-Tarefa de Engenharia da Internet (IETF) D. Hardt, Fd. Solicitago de comentirios: 6749 Microsoft Obsoletes: 5849 outubro de DAoC ee SSeS Abstrato A estrutura de autorizagdo OAuth 2.0 permite que um aplicativo de terceiros obtenha acesso limitado a um servigo HTTP, seja em nome de um proprietério de recurso orquestrando uma interagdo de aprovagao entre o proprietério do recurso e o servigo HTTP, ou permitindo que 0 aplicativo de terceiros obter acesso em seu proprio nome. Esta especificagao substitui ¢ toma obsoleto o protocolo OAuth 1.0 descrito na RFC 5849 Se ed ea en Meee ccs Este documento é um produto da Intemet Engineering Task Force (IETF). Representa 0 consenso da comunidade IETF. Ele recebeu revisio piblica e foi aprovado para publicacao pelo Internet Engineering Steering Group (IESG). Mais informagdes sobre Padres da Internet estilo disponiveis na Segdo 2 da RFC 5741 Informagdes sobre o status atual deste documento, qualquer errata e como fornecer feedback sobre ele podem ser obtidas em http://www.rfe-editor.org/inforrfe6749 Aviso de direitos autorais Copyright (c) 2012 IETF Trust e as pessoas identificadas como os autores do documento. Todos 0s direitos reservados. Este documento esté sujeito ao BCP 78 e as disposigdes legais do IETF Trust relacionadas aos documentos do IETF ( http:/trustee ietf org/license-info ) em vigor na data de publicago deste documento. Por favor, revise estes documentos cuidadosamente, pois eles descrevem seus direitos e restrigdes em relagdo a este documento, Os Componentes de Cédigo extraidos deste documento devem incluir o texto da Licenga BSD Simplificada conforme descrito na Segdo 4.¢ das Disposigdes Legais da Trust e so fornecidos sem garantia conforme descrito na Licenga BSD Simplificada. Pe eee eee eee ted Apéndice B. Uso do tipo de midia application/x-www-form-urlencoded ... 74 Lenya) Panes Beatty Beaters rca) Peer ck tac) = 1.3.1 Cédigo de Autorizagio Pee mcrae) = 133 Credenciais de senha do proprietério do recurso = 1.3.4 Credenciais do Cliente Pee Ocor ty Boe ent) Pera mied Bea ener ee arnd PRE Sen nics Bee Ree a eeccn = 2 Cadastro de Cliente = 2.1 Tipos de Cliente = 2.2 Identificador do Cliente Pew center neta Pees mcirr cere re eae Le Dee meen enti = 3 endpoints de protocolo BNI contd nak Ce eta) PES roc EMP Soy erecta) = 3.1.2.1 Confidencialidade da Solicitagao de Terminal 3.1.2.2 Requisitos de Registro Pee Merten Eee eee et 3.1.2.5 Contetido do Terminal Peer) = 3.2.1 Autenticagao do Cliente Dee enc) Pe mest te eee) = 4.1 Concessio do Cédigo de Autorizagao eSeminar eR ee ar) Dene tc) ese eee end eee aca c) = 4.2 Concessio Implicita Pees Rett Eee et a ane con) Peet = 43 Concessio de credenciais de senha do proprietirio do recurso PPeS Ce ett) Speer sO ec eRe cn = 4.4 Concessio de Credenciais do Cliente SPR ea ee ia) = 4.4.2 Solicitagio de Token de Acesso ee eet Cre co) De eee et ari = 5 Emissdo de um token de acesso BES Coteus) = 5.2 Resposta de erro Rue Mend cre ae PRAM tony coc Bee Cot Pa contact) SESE Si ere ac can een) SPP errr g ee en it * 83 Definindo novos tipos de concessdo de autorizagio = 84 Definindo novos tipos de resposta de terminal de autorizago BRS Sena see CS Ea renner Titel No modelo tradicional de autenticagdo cliente-servidor, o cliente solicita um recurso de acesso restrito (recurso protegido) no servidor autenticando-se com o servidor usando as credenciais do proprietério do recurso, Para fornecet a aplicativos de terceitos acesso a tos, o proprietétio do recurso compartilha suas credenciais com o terceiro, Isso eria varios problemas e limitagGes: Se ees Oe ne Cee sr) eo ee ee ee! 0 Os servidores sio necessérios para suportar autenticacdo de senha, apesar ee eee Seo Reese eno cCe Cent ee ee eee eect ater 0 Os proprietarios de recursos ndo podem revogar 0 acesso a um terceiro individual eke ee paneer rrecriiel 0.0 comprometimento de qualquer aplicativo de terceiros resulta no comprometimento de Pee eee ee ees OAuth aborda esses problemas introduzindo uma camada de autorizagao e separando a fungdo do cliente daquela do proprietitio do recurso, No OAuth, o cliente solicita acesso a recursos controlados pelo proprictério do recurso e hospedados pelo servidor de recursos e recebe um conjunto de eredenciais diferente do proprietério do recurso. Em vez de usar as credenciais do proprietério do recurso para acessar recursos protegidos, o cliente obtém um token de acesso — uma string que denota um escopo especifico, tempo de vida e outros atributos de acesso. Os tokens de acesso so emitidos para clientes de Se eee On ceo ee eee ee ck Seca recursos protegidos hospedados pelo servidor de recursos. Por exemplo, um usuario final (proprietario do recurso) pode conceder a um servigo de impressfo (cliente) acesso &s suas fotos protegidas armazenadas em um servigo de compartilhamento de fotos (servidor de recursos), sem compartilhar seu nome de usuario e senha com o servigo de impressio. Em vez disso, ela se autentica diretamente com um servidor confidvel pelo servigo de compartilhamento de fotos (servidor de autorizagio), que emite as credenciais especificas da delegagao do servigo de impressfo (token rs Esta especificagdo foi projetada para uso com HTTP ( RFC2616 ). O uso de OAuth em qualquer protocolo que no seja HTTP esta fora do escopo. O protocolo OAuth 1.0 ( RFC5849), publicado como documento informativo, foi resultado de um pequeno esforgo comunitario ad hoc. Essa especificagdo do Standards Track se baseia na experiéncia de implantagdo do OAuth 1.0, bem como em casos de uso adicionais ¢ requisitos de extensibitidade reunidos da comunidade IETF mais ampla. O protocolo OAuth 2.0 ndo é compativel com versdes anteriores do OAuth 1.0. As duas verses podem coexistir na rede e as implementagdes podem optar por oferecer suporte a ambas, No entanto, & intencao desta especificago que novas implementagdes oferegam suporte ao OAuth 2.0 conforme especificado neste documento € que 0 OAuth 1.0 seja usado apenas para oferecer suporte a implantages existentes. O protocolo OAuth 2.0 compartitha muito poucos detalhes de implementagdo com o protocolo OAuth 1.0. Os implementadores familiarizados com o OAuth 1.0 devem abordar este documento sem quaisquer suposigdes quanto & sua estrutura e detalhes, aya OAuth define quatro fungSes: Se Or nest) ee eet eee ets [rriparereerts irra ier eenyrenreyir ea ht pmo Samed pe ote ences eee eee red Sree Ee er ae Cee Preserireir a teirre erence ra bet niet ours anaes eee er peer eee tte aaron ae SEATS CCE SEN etree . Nome Cee) © servidor que enite tokens de acesso a0 cliente apts A interagdo entre 0 servidor de autorizagao eo servidor de recursos esta além do escopo desta especificago. O servidor de autorizagao pode ser 0 mesmo servidor que 0 servidor de recursos ou uma entidade separada, Um tinico servidor de autorizago pode emitir tokens de acesso aceitos por varios servidores de recursos. sO ead pester ene crt eae Pepccol Orn aes eee ee Pee etc ol e real eee rary 1 uae coe O fluxo abstrato do OAuth 2.0 ilustrado na Figura 1 descreve a interagdo entre as quatro fungdes e inclui as seguintes etapas: (A) O cliente solicita autorizagao do proprietario do recurso, 0 eee eee ete eee eee re ree ered [cecoeeeeer par ari creer ertrbe ose bieetr oar Monty (B) O cliente recebe uma concessio de autorizagdo, que é um ee er renee ee genre pasar eer eee ern ry irene eet ear ear eer ar PSY Steyr Trete abrir ite near an Sees ORR en RO Ceo et Cte ue aoe ra wosouetinnonomasionnens rn O método preferencial para o cliente obter uma concessio de autorizagdo do proprietério do recurso (representado nas etapas (A) ¢ (B)) & aoe eo ee eC ec ea ere OR CETTE Ty TE Ono On cn CR ace Uh Ono eee On ane en eRe Se OR eee CRO RR a Ce ee cee ee Ree en ce ecco autorizacao, implicito, credenciais de senha do proprietétio do recurso ¢ credenciais do cliente — bem como um mecanismo de extensibilidade para definir tipos adicionais. Cree ate oy O cédigo de autorizagio € obtido usando um servidor de autorizago como intermedisrio entre o cliente e o proprietirio do recurso. Em vez de solicitar autorizagao diretamente do proprietirio do recurso, o cliente direciona o proprietério do recurso para um servidor de autorizagdo (por meio de seu agente de usuério conforme definido na RFC2616 ), que por sua vez direciona o proprietério do recurso de Es cee ccc) Antes de direcionar o proprietirio do recurso de volta ao cliente com o eédigo de autorizagao, o servidor de autorizagao autentica proprictirio do recurso ¢ obtém a autorizagio. Como o proprictério do recurso autentica apenas com o servidor de autoriz credenciais do proprietirio do recurso nunca sio compartilhadas com o cliente. O cédigo de autorizagao fornece alguns beneficios importantes de seguranga, como a capacidade de autenticar o cliente, bem como a transmissdo do token de acesso diretamente ao cliente sem passé-lo pelo agente do usuario do proprietirio do recurso e potencialmente SSO SCO ee er Ty A concessio implicita é um fluxo de cédigo de autorizagao simplificado otimizado para clientes implementados em um navegador usando uma linguagem de script como JavaScript. No fluxo implicito, em vez de emitir um cédigo de autorizacdo ao cliente, o cliente recebe um token de acesso diretamente (como resultado da autorizagdo do proprietario do recurso). O tipo de concessao & implicito, pois nenhuma credencial intermediaria (como um cédigo de autorizagdo) é emitida (¢ posteriormente usada para obter um token de acesso). Ao emitir um token de acesso durante 0 fluxo de concessio implicito, o servidor de autorizagdo ndo autentica o cliente, Em alguns casos, a identidade do cliente pode ser verificada por meio do URI de redirecionamento usado para entregar 0 token de acesso ao cliente. O token de acesso pode ser exposto ao proprictirio do recurso ou a outros aplicatives com acesso 20 agente do usuério do proprictério do od As concessdes implicitas melhoram a capacidade de resposta e a eficigncia de alguns clientes (como um cliente implementado como um aplicativo no navegador), pois reduz o niimero de viagens de ida e volta necessérias para obter um token de acesso. No entanto, essa conveniéncia deve ser ponderada em relacio as implicagdes de seguranga do uso de concessdes implicitas, como as descritas nas Seges 10.3 e 10.16, especialmente quando o tipo de concessio de cédigo de autorizagao esta disponivel. Credenciais de senha do proprietario do recurso The resource owner password credentials (ic, usemame and password) can be used directly as an authorization grant to obtain an access token, The credentials should only be used when there is a high degree of trust between the resource owner and the client (e.g., the client is part of the device operating system or a highly privileged application), and when other authorization grant types are not available (such REE tee) Even though this grant type requires direct client access to the resource owner credentials, the resource owner credentials are used for a single request and ate exchanged for an access token. This grant type can eliminate the need for the client to store the resource owner credentials for future use, by exchanging the credentials with a long-lived access token ot refresh token, Client Credentials The client credentials (or other forms of client authentication) can be used as an authorization grant when the authorization scope is, limited to the protected resources under the control of the client, of to protected resources previously arranged with the authorization server. Client credentials are used as an authorization grant typically when the client is acting on its own behalf (the client is also the resource owner) or is requesting access to protected resources based on an authorization previously arranged with the authorization ares ore a cL} Access tokens are credentials used to access protected resources. An access token is a string representing an authorization issued to the client. The string is usually opaque to the client. Tokens represent specific scopes and durations of access, granted by the resource owner, and enforced by the resource server and authorization server. DO oe Ce RR eee ee ae verifiable manner (i... a token string consisting of some data and a signature). Additional authentication credentials, which are beyond the scope of this specification, may be required in order for the client to use a token. The access token provides an abstraction layer, replacing different authorization constructs (e-g., username and password) with a single token understood by the resource server. This abstraction enables issuing access tokens more restrictive than the authorization grant used to obtain them, as well as removing the resource server's need to understand a wide range of authentication methods, Access tokens can have different formats, structures, and methods of utilization (e.g., cryptographic properties) based on the resour server security requirements, Access token attributes and the methods used to access protected resources are beyond the scope of this. specification and are defined by companion specifications such as RFC6750. SOM cay Refresh tokens are credentials used to obtain access tokens. Refresh tokens are issued to the client by the authorization server and are used to obtain a new access token when the current access token becomes invalid or expires, or to obtain additional access tokens with identical or narrower scope (access tokens may have a shorter lifetime and fewer permissions than authorized by the resource owner), Issuing a refresh token is optional at the discretion of the authorization server. If the authorization server issues a refresh token, itis, included when issuing an access token (ie, step (D) in Figure 1). A refresh token is a string representing the authorization granted to the client by the resource owner. The string is usually opaque to the client, The token denotes an identifier used to retrieve the authorization information, Unlike access tokens, refresh tokens are intended for use only with authorization servers and are never sent to Sea “ Petree a coerce ocean i ected Resource --| Resource | Server Cece i CET ona eee ene esr rere) eC ena eRe ee ec aes (A) The client requests an access token by authenticating with the (B) The authorization server authenticates the client and validates (©) The client makes a protected resource request to the resource (D) The resource server validates the access token, and if valid, COS RRC LE ae coe eR eee nee ee reer (F) Since the access token is invalid, the resource server retums an invalid token error. (G) The client requests a new access token by authenticating with ‘the authorization server and presenting the refresh token. The reece cece eee Sead (H) The authorization server authenticates the client and validates prettier) eee ee te Steps (C), (D), (E), and (F) are outside the scope of this specification, as described in Section 7. Rn Whenever Transport Layer Security (TLS) is used by this specification, the appropriate version (or versions) of TLS will vary over time, based on the widespread deployment and known security vulnerabilities. At the time of this writing, TLS version 1.2 RFC5246 is the most recent version, but has a very limited deployment base and might not be readily available for implementation. TLS version 1.0 RFC2246 is the most widely deployed version and will provide the broadest interoperability Implementations MAY also support additional transport-layer security mechanisms that meet their security requirements. eM UConn This specification makes extensive use of HTTP redirections, in which the client or the authorization server directs the resource owner's user-agent to another destination, While the examples in this specification show the use of the HTTP 302 status code, any other method available via the user-agent to accomplish this redirection is allowed and is considered to be an implementation detail. Te eI ag OAuth 2.0 provides a rich authorization framework with well-defined security properties. However, as a rich and highly extensible framework with many optional components, on its own, this specification is likely to produce a wide range of non-interoperable eres In addition, this specification leaves a few required components partially or fully undefined (e.g., client registration, authorization server capabilities, endpoint discovery). Without these components, clients must be manually and specifically configured against a specific authorization server and resource server in order to interoperate. This framework was designed with the clear expectation that future work will define prescriptive profiles and extensions necessary to Poree eave een acs og Notational Conventions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this specification are to be interpreted as described in RFC2119. This specification uses the Augmented Backus-Naur Form (ABNF) notation of RFC5234, Additionally, the rule URL-reference is included from "Uniform Resource Identifier (URI): Generic Syntax” RFC3986. Certain security-related terms are to be understood in the sense defined in RFC4949. These terms include, but are not limited to, “attac "authentication", "authorization, "certificate", "confidentiality", "credential", “encryption”, "identity", "sign", "signature", "trust", Seem Rac Sa Ue ee RC Eke Leak OTS ute Before initiating the protocol, the client registers with the authorization server. The means through which the client registers with the authorization server are beyond the scope of this specification but typically involve end-user interaction with an HTML registration form. Client registration does not require a direct interaction between the client and the authorization server, When supported by the authorization server, registration can rely on other means for establishing trust and obtaining the required client properties (e.g., redirection URI, client type). For example, registration can be accomplished using a selfissued or third-party-issued assertion, or by the authorization server performing client discovery using a trusted channel When registering a client, the client developer SHALL: o specify the client type as described in Section 2.1, o provide its client redirection URIs as described in Section 3.1.2, SSM RS ee ee USE eared ee ee ee eee ay Pee Client Types OAuth defines two client types, based on their ability to authenticate securely with the authorization server (i.e, ability to maintain the Set een tees eters tel) Sot eneTy eee are aree eter eae ate see en easter eects Prbueabiebersesreramienrapimeeetts ag Slee sere acre mere een eer pve PCr arTicciree ere ny errrarre ass ne ee ee eee ne Seer esc) Mer EGS Soret atts heeeseerohaceipere anon The client type designation is based on the authorization server's definition of secure authentication and its acceptable exposure levels of client credentials. The authorization server SHOULD NOT make assumptions about the client type. A client may be implemented as a distributed set of components, each with a different client type and security context (e.g., a distributed See Coen Rea ten ee ee co cee ee ee cy provide support for such clients or does not provide guidance with regard to their registration, the client SHOULD register each See eee as This specification has been designed around the following client profiles: Serrated ee eer cen eee Interface rendered in a user-agent on the device used by the Paes ai ra rrersiee sac abr ereeare nese ‘token issued to the client are stored on the web server and are Reece eran) ee er tern rene sterner ees eee mer eer ee teri eres Pesaro ame ia eee epee era eaeereits ices sah bareneereamirrr Derprten re Pe eo pera) eee) Par ea rereaeerascaveeriSTas Rerun AreSt maT] issued credentials such as access tokens or refresh tokens can Eoeertrabtetvecets Pantera aeecneesses Marta LOM nT e protected fron other applications residing on the sane ee Cig The authorization server issues the registered client a client identifier -- a unique string representing the registration information provided by the client. The client identifier is not a sectet; it is exposed to the resource owner and MUST NOT be used alone for client authentication. The client identifier is unique to the authorization server. The client identifier string size is left undefined by this specification, The client should avoid making assumptions about the identifier size. The authorization server SHOULD document the size of any identifier it issues. oe U eC) [fthe client type is confidential, the client and authorization server establish a client authentication method suitable for the security requirements of the authorization server. The authorization server MAY accept any form of client authentication meeting its security Penineatats Confidential clients are typically issued (or establish) a set of client eredentials used for authenticating with the authorization server (c.g., See ert og Lo) ee Oe Nae Re eon R a eee erence ee aos VS NOT rely on public client authentication for the purpose of identifying the client. The client MUST NOT use more than one authentication method in each request. ST | Clients in possession of a client password MAY use the HTTP Basic authentication scheme as defined in RFC2617 to authenticate with the authorization server. The client identifier is encoded using the "application/x-www-form-urlencoded” encoding algorithm per Appendix B, and the encoded value is used as the username; the client password is encoded using the same algorithm and used as the password. The authorization server MUST support the HTTP Basic authentication scheme for authenticating clients that were issued a ee! eee CeO eee eae ND ere ec SL eet Seta a) Alternatively, the authorization server MAY support including the client credentials in the request-body using the following parameters: Tera Pe Serene creer ky eereete a erty the registration process described by Section 2.2. client_s ee aS ea eae ea rer Including the client credentials in the request-body using the two parameters is NOT RECOMMENDED and SHOULD be limited to clients unable to directly utilize the HTTP Basic authentication scheme (or other password-based HTTP authentication schemes). The parameters can only be transmitted in the request-body and MUST NOT be included in the request URI. For example, a request to refresh an access token (Section 6) using the body parameters (with extra line breaks for display purposes ay) omer omaisees epee try eee ca See eee cc SRR eRe eee ee cn ects Since this client authentication method involves a password, the authorization server MUST protect any endpoint utilizing it against brute force attacks. OT ee ORL Tee eae NAC eee ee eae nc eae ee Reece ena tag authentication methods, the authorization server MUST define a mapping between the client identifier (registration record) and. Peete es Unregistered Clients This specification does not exclude the use of unregistered clients. However, the use of such clients is beyond the scope of this specification and requires additional security analysis and review ofits interoperability impact. Protocol Endpoints The authorization process utilizes two authorization server endpoints (HTTP resources): o Authorization endpoint - used by the client to obtain eee rae ere o Token endpoint - used by the client to exchange an authorization As well as one client endpoint: o Redirection endpoint - used by the authorization server to return Not every authorization grant type utilizes both endpoints. Extension grant types MAY define additional endpoints as needed, ROTO OG ns The authorization endpoint is used to interact with the resource owner and obtain an authorization grant. The authorization server MUST. first verify the identity of the resource owner. The way in which the authorization server authenticates the resource owner (c.g., username Son ace OR Stan co een cece The means through which the client obtains the location of the authorization endpoint are beyond the scope of this specification, but the location is typically provided in the service documentation. Oe LGA ER Le aa ee Me Lek StU ee Ren ees OL Section 3.4), which MUST be retained when adding additional query parameters. The endpoint URI MUST NOT include a fragment Seat ince requests to the authorization endpoint result in user authentication and the transmission of clear-text credentials (in the HTTP Se Nea eae ee tom Ree et ee ee ccc) Src The authorization server MUST support the use of the HTTP "GET" method RFC2616 for the authorization endpoint and MAY support ea eS ane Eco Parameters sent without a value MUST be treated as if they were omitted from the request. The authorization server MUST ignore unrecognized request parameters. Request and response parameters MUST NOT be included more than once. ery The authorization endpoint is used by the authorization code grant type and implicit grant type flows. The client informs the authorization server of the desired grant type using the following parameter: Sed Se Re oe eet ety ee eee eer ter eet papier Extension response types MAY contain a space-delimited (7x20) list of values, where the order of values does not matter (e.g., response type "a b" is the same as "b a"). The meaning of such composite response types is defined by their respective specifications. [fan authorization request is missing the "response _type" parameter, or ifthe response type is not understood, the authorization server MUST return an error response as described in Section 4.1.2.1 ee Tn After completing its interaction with the resource owner, the authorization server directs the resource owner's user-agent back to the client, The authorization server redirects the user-agent to the client's redirection endpoint previously established with the authorization server during the client registration process or when making the authorization request. The redirection endpoint URI MUST be an absolute URI as defined by RFC3986 Section 4.3. The endpoint URI MAY include an Pee a eee me se eine eae en ee Sere eNOS T Re ceeTLT when adding additional query parameters. The endpoint URI MUST NOT include a fragment component, Se eed The redirection endpoint SHOULD requite the use of TLS as described in Section 1.6 when the requested response type is "code" or "token", or when the redirection request will result in the transmission of sensitive credentials over an open network. This specification does not mandate the use of TLS because at the time of this writing, requiring clients to deploy TLS is a significant hurdle for many client developers. If TLS is not available, the authorization server SHOULD warn the resource owner about the insecure endpoint prior to redirection (e.g, display a message during the authorization request). Lack of transport-layer security can have a severe impact on the security of the client and the protected resources it is authorized to access. The use of transport-layer security is particularly critical when the authorization process is used as a form of delegated end-user authentication by the client (e.g., third-party sign-in service). Se ees TT OSC OS ORS gee ee Se o Public clients o Confidential clients utilizing the implicit grant type. The authorization server SHOULD require all clients to register their redirection endpoint prior to utilizing the authorization endpoint. He eae een TL oa Roe eo Cae parameter to achieve per-request customization). If requiring the registration of the complete redirection URI is not possible, the Nea OU eee eee Reece CT KO eek ce AC oy only the query component of the redirection URI when requesting authorization). The authorization server MAY allow the client to register multiple redirection endpoints. Lack of a redirection URI registration requirement can enable an attacker to use the authorization endpoint as an open redirector as ete ene} en ery If multiple redirection URIs have been registered, if only part of the redirection URI has been registered, or if no redirection URI has been registered, the client MUST include a redirection URI with the authorization request using the "rediect_uri" request parameter. See iene eee Re scene em ee eee CU Ren eee cen eRe against at least one of the registered redirection URIs (or URI components) as defined in RFC3986 Section 6, if any redirection URIs were registered. If the client registration included the full redirection URI, the authorization server MUST compare the two URIs using simple string comparison as defined in RFC3986 Section 6.2.1. DOr oy If an authorization request fails validation due to a missing, invatid, or mismatching redirection URI, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI. See The rediection request to the client's endpoint typically results in an IITML document response, processed by the user-agent. Ifthe HTML response is served directly as the result of the redirection request, any script included in the HTML document will execute with full access to the redirection URI and the credentials it contains. The client SHOULD NOT include any third-party scripts (e.g., third- party analytics, social plug-ins, ad networks) in the redirection endpoint response. Instead, it SHOULD extract the credentials from the URI and redirect the user-agent again to another endpoint Se ee eee ek en aa une SS eC Vee er ca od Ceeenne toe then ese cn scr ae kai eetecteriat Om OUT SOUS The token endpoint is used by the client to obtain an access token by presenting its authorization grant or refresh token. The token endpoint is used with every authorization grant except for the implicit grant type (since an access token is issued directly) The means through which the client obtains the location of the token endpoint are beyond the scope of this specification, but the location is typically provided in the service documentation, Te on eee oe eee me ey ea em rest Section 3.4), which MUST be retained when adding additional query parameters. The endpoint URI MUST NOT include a fragment Sears Since requests to the token endpoint result in the transmission of clear-text credentials (in the HTTP request and response), the authorization server MUST require the use of TLS as described in Section 1.6 when sending requests to the token endpoint. Tee eV Te ee Ran ee ee nee Parameters sent without a value MUST be treated as if they were omitted from the request. The authorization server MUST ignore unrecognized request parameters. Request and response parameters MUST NOT be included more than once. Srey Confidential clients or other clients issued client credentials MUST authenticate with the authorization server as described in Section 2.3, when making requests to the token endpoint. Client authentication is used for: o Enforcing the binding of refresh tokens and authorization codes to ‘the client they were fssued to. Client authentication x eritical Reber eee be etna ce tartary eaReoaeert reer alll chal Re ie al al pecteeeese so etE TY een eRe ose a ae ans See oe eee eee ae eee Seen al 7 Se ee eo eee cL require periodic credential rotation. Rotation of an entire set Care ero ree ae teeta eens ceases A client MAY use the “client_id" request parameter to identify itself when sending requests to the token endpoint. In the "authorization_code” "grant_fype" request to the token endpoint, an unauthenticated client MUST send its "client id to prevent itself from inadvertently accepting a code intended for a client with a different "client_id”. This protects the client from substitution of the authentication code. (It provides no additional security for the protected resource.) NSM cod The authorization and token endpoints allow the client to specify the scope of the access request using the "scope" request parameter. In TR tae a eee Re coe The value of the scope parameter is expressed as a list of space- delimited, case-sensitive strings. The strings are defined by the authorization server. If the value contains multiple space-delimited strings, their order does not matter, and each string adds an additional access range to the requested scope. ee een) Freee eee eee) The authorization server MAY fully or partially ignore the scope requested by the client, based on the authorization server policy or the resource owner's instructions. If the issued access token scope is different from the one requested by the client, the authorization server MUST include the "scope" response parameter to inform the client of the actual scope granted. Ifthe client omits the scope parameter when requesting authorization, the authorization server MUST either process the request using a pre-defined default value or fail the request indicating an invalid scope. The authorization server SHOULD document its scope requirements and default value (if defined). Obtaining Authorization To request an access token, the client obtains authorization from the resource owner. The authorization is expressed in the form of an authorization grant, which the client uses to request the access token. OAuth defines four grant types: authorization code, implicit, resource owner password credentials, and client credentials. It also provides an extension mechanism for defining additional grant types. ROO eres The authorization code grant type is used to obtain both access tokens and refresh tokens and is optimized for confidential clients. Since this is a redirection-based flow, the client must be capable of interacting with the resource owner's user-agent (typically a web browser) and capable of receiving incoming requests (via redirection) from the authorization server. rere 4 Pare nest heat eee i eel eet ee meee! i i Ono crema Paster Crema Note: The lines illustrating steps (A), (B), and (C) are broken into two parts as they pass through the user-agent. pene eta PO enon ee eC ee (A) The client initiates the flow by directing the resource owner's Fe eee a a See Frege ect tomer ine te roti Be cowry Gser-agent back once access 1s granted (or dented) (B) The authorization server authenticates the resource owner (via ‘che user-agent) and establishes whether the resource oxner Pee eee ete eects (C) Assuming the resource owner grants access, the authorization server redirects the user-agent back to the client using the Porraieeeeiitaneereie pecs teearchpeeanen reeset error arerr eer saa reeoTre Yoana ces re patie (D) The client requests an access token from the authorization server's token endpoint by including the authorization code er ror a er ee anny carmarerts CEC TC ace eee cre Rca eee onn pees perdepeaer a cat eoe cemmeertoeede ris Peery) Rotaract ies neiremrensr en venreorn rear TOU Crd The client constructs the request URI by adding the following parameters to the query component of the authorization endpoint URL asing the "application/x-www-form-urlencoded” format, per Appendix B: response_type Ce eee ees client_id REQUIRED. The client Sdentifer as described in Section 2.2. redirect_uri Eee eter et eete eee? oy oe See Oe Reece) ear erecr eee ee aa et ec) Petapeapt te ein bares aheesrortearueeoarbset stares Coen ea eee ete ce Cea The client directs the resource owner to the constructed URI using an HTTP redirection response, or by other means available to it via reer For example, the client directs the user-agent to make the following HTTP request using TLS (with extra line breaks for display purposes ay Cee ee meee eed Passes eerrcer cect tee oetostec eee ie ML Taee ee CaaS een ee cee ee Rc cence gC authorization server authenticates the resource owner and obtains an authorization decision (by asking the resource owner or by establishing approval via other means). When a decision is established, the authorization server directs the user-agent to the provided client redirection URI using an HTTP redirection response, or by other means available to it via the user-agent. Re Ce ere ee ee eae ee Re ee See Sg adding the following parameters to the query component of the redirection URI using the "application/x-www-form-urlencoded” format, Neen? ary oreo ea See Ce ae eee aes Shortly after it 1s issued to mitigate the risk of leaks. Roe Oca ero erec nec Seana eee a en eer tere eee SES Pacha aerated beeper Reereonatb oo Se eae Pec ers For example, the authorization server redireets the user-agent by sending the following HTTP response: Cee Dee Sea gy eee eee eee ec cer Ne ecN Pears The client MUST ignore unrecognized response parameters. The authorization code string size is left undefined by this specification. The client should avoid making assumptions about code value sizes. The authorization server SHOULD document the size of any value it Error Response Ifthe request fails due to a missing, invalid, or mismatching redirection URI, or ifthe client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the Pec hes ecronLem Ifthe resource owner denies the access request or if the request fails for reasons other than a missing or invalid redirection URI, the authorization server informs the client by adding the following parameters to the query component of the redirection URI using the Pyare nC ae aa ad ce Ocean eee ey rere eed Sree entre ae cat e Pee eee an Ree eat Peis baee reste eens ees) Seen e eC eta aed Crete are mat) (iirrareeiner ener ntnn er teenies Cena eee enter Ren inatiand Senn reereneat) eo eee mene Seber necarra eihseeeceribeeesterteeaer eyeing Praesens Verena Spe rer reer rOanIE Pee Terence eerie) Cea ga este cs Deere rine rewire Weis Saray Set ee ee ero ee a en Aten er tore eae anette ose ere Ste wae ce WET? Poet ee CeCe eee ee Rostra eee oregneneunnera gear eet poets reer Wier is REQUIRED Sf a “state” paraneter was present in the client pris For example, the authorization server redirects the user-agent by sending the following HTTP response: PME BORIC eC Ree aCe aces ene crane RSM oa ed The client makes a request to the token endpoint by sending the following parameters using the “application/x-www-form-urlencoded” format per Appendix B with a character encoding of UTF-8 in the HTTP request entity-body aCe Se eta er Se ocd aeeereEnest eae Se Rea omer rete client_id Oe tote Ck) Becca eer ee ern aer eee Ifthe client type is confidential or the client was issued client credentials (or assigned other authentication requirements), the client Nem Te arC Reem Ce cece et cca ERC eae For example, the client makes the following HTTP request using TLS (with extra line breaks for display purposes only) oe ees eee ec eager Peon reteset teen) ee oem ea mee air saatienneee steels tisathaeri etext i eeretiny ena o require client authentication for confidential clients or for any ee CeO ecec cs econo o authenticate the client if client authentication is included, o ensure that the authorization code was issued to the authenticated Soeur ESE neue cea o verify that the authorization code is valid, and a ORL Soren tner bce 7 eee NS TET If the access token request is valid and authorized, the authorization server issues an access token and optional refresh token as described in Section 5.1. If the request client authentication failed or is invalid, the authorization server returns an error response as described in eee? An example successful response: Cer esas eee Pewee Rete Reet ne er ples restitsecrt es RTT , Te eres The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a browser using a scripting language Seer Since this is a redirection-based flow, the client must be capable of interacting with the resource owner's user-agent (typically a web browser) and capable of receiving incoming requests (via redirection) from the authorization server. Unlike the authorization code grant type, in which the client makes separate requests for authorization and for an access token, the client receives the access token as the result of the authorization request. The implicit grant type does not include client authentication, and relies on the presence of the resource owner and the registration of the redirection URI. Because the access token is encoded into the redirection URI, it may be exposed to the resource owner and other applications residing on the same device. Caren a ee i nero aay] i i cereal i een eae i i 1 Cone ere eee i i Ce 4 i re i 8 “ 1 One rere eee marten i Coca a cc a , cael i d 3 i i CON eer rey i SCRE OEE ak RC oe CR kc aaa The flow illustrated in Figure 4 includes the following steps: (A) The client initiates the flow by directing the resource owner's Oper emcee eae Ieee) eres boner rc erp aristrea ren tireniee nes Herska eompeonsrosmearranieitrrircunryara)) (B) The authorization server authenticates the resource owner (via eres een a eer OP eee ere eee me eect aero ae see etre peoetesee cere ehecaT roared Deere CeO CUE Sec Acne ee ee ee ea eed Sear eee cats ar eT (E) The web-hosted client resource returns a web page (typically an ee eee eee eee Orr eee ae ea ed coe erro eee een ne! paraneters) contained in the #ragnent, (Oe rece cas Cone ener a cart se CRTs ad (G) The user-agent passes the access token to the client. See S tions 1.3.2 and 9 for background on using the implicit grant. See Sections 10.3 and 10.16 for important security considerations Sauer Ree eT ene ae Oe se Re ee using the "application/x-www-form-urlencoded” format, pet Appendix B: response _type ee ens Sere Pee er eee ee eee redirect_uri Cee eee eee? So state See eee eee eee eens Peete erie et certo) Piaoapt tei bares theesrort mort eeoarbseteetanetas The client directs the resource owner to the constructed URI using an HTTP redirection response, or by other means available to it via Tees For example, the client directs the user-agent to make the following ITP request using TLS (with extra line breaks for display purposes ay Cerne mere eee ered Pesan ere sr cerita teci oe anaes ieee eet The authorization server validates the request to ensure that all required parameters are present and valid. The authorization server MUST verify that the redirection URI to which it will redirect the access token matches a redirection URI registered by the client as described in Section 3.1.2. If the request is valid, the authorization server authenticates the resource owner and obtains an authorization decision (by asking the Ret eeea ere sn Rte ee se} When a decision is established, the authorization server directs the user-agent to the provided client redirection URI using an HTTP. redirection response, or by other means available to it via the user-agent. Ree Ce cro Ifthe resource owner grants the access request, the authorization server issues an access token and delivers it to the client by adding the Rs eee eet eR eee tere re niet ea ae Cee as Pinay access_token Sn eee ec eee ener tees em pa ee eee eet) expires_in Pee a aren eee none Pee ae ae ee ee ae aneoePoaneaiear cy Prenat eens Caer one eres co See ee eee aes The authorization server MUST NOT issue a refresh token, ee eee eM ee purposes only): See rene eee ee ee eee ge CaaS Peataenantereelenserena tea ear ne) Developers should note that some user-agents do not support the inclusion of a fragment component in the HTTP "Location" response header field. Such clients will require using other methods for redirecting the client than a 3xx redirection response — for example, returning an HTML page that includes a ‘continue’ button with an action linked to the redirection URL Tee oe oc acc me See cm client should avoid making assumptions about value sizes. The authorization server SHOULD document the size of any value it issues. ee Ifthe request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the Pues cer nel Ifthe resource owner denies the access request or if the request fails for reasons other than a missing or invalid redirection URI, the authorization server informs the client by adding the following parameters to the fragment component of the redirection URI using the "application/x-www-form-urlencoded" format, per Appendix B: Se On cees can eee enn) ements Ronee entre ceca PE Reee eer carn ere es eee Petree eee mt) (Girrereeeiies neritic eres Caen aera eee enor Rennat iad enn rere) Senseo She authorization server 4s currently unable to handle Pree irecarrar ri seree pester reread Frasers eareereee acer reer ee ee eee ieee ata) ase resem neers) Se ge eects Peereartn ere ewe etic Sea ery Cen ee eC cre Camere tty Seer ee ara recess Trae at ooey ee a en Satie Nea eerste a eae t at Eee eni err aer re Stewie re wes a} eee ree ore ects peptone cece eer a ee Petre aL ee og ky Coes rere Wierd ro REQUIRED Af a “state” paraneter was present in the client pec tea eee a thateerice i nas Bris For example, the authorization server redirects the user-agent by sending the following HTTP response: HTTP/1.1 302 Found Location: https://client.example.com/ebterror—access_denied&state-xyz Resource Owner Password Credentials Grant The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application, The authorization server should take special care when entabling this grant type and only allow it when other flows are not, viable. This grant type is suitable for clients capable of obtaining the resource owner's credentials (usemame and password, typically using an interactive form). Itis also used to migrate existing clients using direct authentication schemes such as HTTP Basic or Digest authentication to OAuth by converting the stored credentials to an access token. tony Cec asiarbony een i Eee eer a eee ee" | Cee “| ' Caen eacy eee ee eee reese The flow illustrated in Figure 5 includes the following steps: (A) The resource owner provides the client with its username and Pee (B) The client requests an access token from the authorization Re ae Cate ee ere re ety (C) The authorization server authenticates the client and validates See eae ete eee eee nt CeO eC Rated The method through which the client obtains the resource owner credentials is beyond the scope of this specification. The client MUST discard the credentials once an access token has been obtained. cea ones The client makes a request to the token endpoint by adding the following parameters using th format per Appendix B with a character encoding of UTF-8 in the HTTP request entity-body: Pye ee nee tere coe Sr oer ee Se ees oT peer) eo Ce eee ee eee eer Ifthe client type is confidential or the client was issued client credentials (or assigned other authentication requirements), the client MUST authenticate with the authorization server as described in Section 3.2.1 ec eS ea eee eC SpE Roo maees Pcoee ee ee tare eee Sree testa Cater) ee eee eee rea eee USE o require client authentication for confidential clients or for any Se RC ences presets teen o authenticate the client if client authentication is included, and o validate the resource owner password credentials using its eee ketenes Se Cae oe cea eR Oe CL an force attacks (e.g., using rate-limitation or generating alerts) RR Oey Tod [f the access token request is valid and authorized, the authorization server issues an access token and optional refresh token as described in Section 5.1. Ifthe request failed client authentication or is invalid, the authorization server returns an error response as described in eee Ren Sec iO Rs ee eerie) ene ts ieee ae pe biaceneea eae ra cao Client Credentials Grant The client can request an access token using only its client credentials (or other supported means of authentication) when the client is requesting access to the protected resources under its control, or those of another resource owner that have been previously arranged with the authorization server (the method of which is beyond the scope of this specification), The client credentials grant type MUST only be used by confidential clients. i Se eee tetc meester ores OSes eee 2 i The flow illustrated in Figure 6 includes the following steps: CONUS nee RRC rae eee Reece Sas (B) The authorization server authenticates the client, and if valid, nee Rn eC eC BS Te eS en eee et Cece Ce CCCs eh Access Token Request The client makes a request fo the token endpoint by adding the following parameters using the "application/x-www-form-urlencoded” ee ee ene Re Reece Te MRE UMC ee eee me Sey REQUIRED. Value MUST be set to “cLSent_credentials Se eC Veet Ce ee Cre er ec ee For example, the client makes the following HTTP request using transport-layer security (with extra line breaks for display purposes, ay oe ees Pconr eerie eter oc ey ee eae tierce ieee) The authorization server MUST authenticate the client. ese Ld Ifthe access token request is valid and authorized, the authorization server issues an access token as described in Section 5.1. A refresh token SHOULD NOT be included. If the request failed client authentication or is invalid, the authorization server retums an error response as described in Section 5.2. An example successful response: Cees ee ec) eased esate Tas aoe roar oCme tes CC Rere Ty The client uses an extension grant type by specifying the grant type using an absolute URI (defined by the authorization server) as the value of the "grant_type” parameter of the token endpoint, and by adding any additional parameters necessary. For example, to request an access token using a Security Assertion Markup Language (SAML) 2.0 assertion grant type as defined by CMS een Eee a ee en Rec eee aL ee aaees [oarseie alee trettee eee eee taE) Renee ee ee eter ea eereeeeet Laereriveeatieer se neaterrm tienen ate restr ipa rereesnerentenees erect tar Mace tenn) If the access token request is valid and authorized, the authorization server issues an access token and optional refresh token as described in Section 5.1, If the request failed client authentication or is invalid, the authorization server returns an error response as described in Seen Issuing an Access Token If the access token request is valid and authorized, the authorization server issues an access token and optional refresh token as described in Section 5.1, If the request failed client authentication or is invalid, the authorization server retums an error response as described in renee? SSS The authorization server issues an access token and optional refresh token, and constructs the response by adding the following parameters to the entity-body of the HTTP response with a 200 (OK) status code: en Sen rere ee eee rca Seo cr ee ere erie) Poche a ee nena eters Sm) ST ee eee ee Oe ete wer eee enc rt fxpire in one nour fron the tine the response was generated Sie ee eee eect es ema Ca eee ee cee) eee Ee eee eset eee eae) reer scope Ce CeCe rreer aSresy Perea oo Sener gt eer Rrra es oeeeererir rere) The parameters are included in the entity-body of the HTTP response using the "application/json” media type as defined by RFC4627. The parameters are serialized into a JavaScript Object Notation (JSON) structure by adding each parameter at the highest structure level. Parameter names and string values are included as JSON strings. Numerical values are included as JSON numbers. The order of parameters does not matter and can vary. The authorization server MUST include the HTTP "Cache-Control" response header field RFC2616 with a value of "no-store” in any response containing tokens, credentials, or other sensitive information, as well as the "Pragma” response header field RFC2616 with a eae ogee nts eo eee! eae reser ieee ae peers er eee The client MUST ignore unrecognized value names in the response. The sizes of tokens and other val ived from the authorization server ate left undefined. The client should avoid making assumptions about value sizes. The authorization server SHOULD document the size of any value it issues. Da oad The authorization server responds with an HTTP 400 (Bad Request) status code (unless specified otherwise) and includes the following, parameters with the response: ce Ocoee ee en) fend eee or ae een renee at cen ee ease Utilizes more than one nechanden for authenticating the eerste eee nce aoe Prater coer eer eer eter ey Picea Sette arateteraieitioe pirinetr enero mura Seah nttr nictiercitcs er ee eaten eer) PEST Rear the esetewn Svea oboe? iterator epee rele en sonnet rnd Pecos Re proviced authorization grant (e.g-, authorization Paneer npr ae rare ee erreUey etn i Biase Shear Coe ee et eae See ee a a ete ets Perera Sewer Wes crror_description Cee erecta tcaa eet SRC Reese ae tose) Peer ae eens Syste art sate reese Pearse ea eect personne btw err wEtece Warts Anfornation abost the error, used to provide the client Pastrana ot oe eer ee Pee a ee og nen Cesare rears Wie ies eee en ee eee a Ce ee cu ee cc ery The parameters are serialized into a JSON structure by adding each parameter at the highest structure level. Parameter names and string, values are included as JSON strings. Numerical values are included as JSON numbers. The order of parameters does not matter and can ae Ramee ts Cees ann et enna ars Se aicee dali poesia ee ected > Refreshing an Access Token Ifthe authorization server issued a refresh token to the client, the client makes a refresh request to the token endpoint by adding the following parameters using the "application/x-www-form-urlencoded" format per Appendix B with a character encoding of UTE-8 in the Tee Soe) REQUIRED. Value MUST be set to "refresh_toten Oc REQUIRED. The refresh token Issued to the client ed Car ee a eee tee eer eee eee el ee ech ere tne Oe Re tii Sioa Because refresh tokens are typically long-lasting credentials used to request additional access tokens, the refresh token is bound to the client to which it was issued. If the client type is confidential or the client was issued client credentials (or assigned other authentication. requirements), the client MUST authenticate with the authorization server as described in Section 3.2.1 For example, the client makes the following HTTP request using transport-layer security (with extra line breaks for display purposes, ay) oueagees Parent race een) (eorers eae steerer tee meester) Se ee ees ee CeCe Sree ence ment RTOS Tg ee Ce OCCU Seer o authenticate the client if client authentication is included and ee eee ken erred o validate the refresh token, If valid and authorized, the authorization server issues an access token as described in Section 5.1. If the request failed verification or is invalid, the authorization server retums an error response as described in Section 5.2, The authorization server MAY issue a new refresh token, in which case the client MUST discard the old refresh token and replace it with the new refresh token. The authorization server MAY revoke the old refresh token after issuing a new refresh token to the client. If a new refresh token is issued, the refresh token scope MUST be identical to that of the refresh token included by the client in the request. Accessing Protected Resources The client accesses protected resources by presenting the access token to the resource server, The resource server MUST validate the ss token and ensure that it has not expired and that its scope covers the requested resource. The methods used by the resource server to validate the access token (as well as any error responses) are beyond the scope of this specification but generally involve an interaction Rene oh ee rae Re neater The method in which the client utilizes the access token to authenticate with the resource server depends on the type of access token issued by the authorization server. Typically, it involves using the HTTP "Authorization" request header field RFC2617 with an authentication scheme defined by the specification of the access token type used, such as RFC67S0. ecm uM Ay a} The access token type provides the client with the information required (o successfully utilize the access token to make a protected resource request (along with type-specific attributes). The client MUST NOT use an access token if it does not understand the token oa For example, the "bearer" token type defined in RFC6750 is utilized by simply including the act See nee oct eee aera eo Pieseeresureese teen et ar tr SO ee coy OOO Eee Cee eee om tg UR ee CNet Re mee Soka seer Cuero ares eee eC eC ee peer errr The above examples are provided for illustration purposes only. Developers are advised to consult the RFC6750 and [OAuth-HTTP- IG creo ora Fach access token type definition specifies the additional attributes (if any) sent to the client together with the "access_token" response parameter. It also defines the HTTP authentication method used to include the access token When making a protected resource request. De ond Ifa resource access request fails, the resource server SHOULD inform the client of the error. While the specifies of such error responses are beyond the scope of this specification, this document establishes a common registry in Section 11.4 for error values to be shared See Oca Re ea New authentication schemes designed primarily for OAuth token authentication SHOULD define a mechanism for providing an error status code to the client, in which the error values allowed are registered in the error registry established by this specification, Such schemes MAY limit the set of valid error codes to a subset of the registered values. Ifthe error code is retumed using a named Se es ea eas ee cs Other schemes capable of being used for OAuth token authentication, but not primarily designed for that purpose, MAY bind their error values to the registry in the same manner. New authentication schemes MAY choose to also specify the use of the "error_description” and "error_uri" parameters to return error information in a manner parallel to their usage in this specification, Extensibility Defining Access Token Types Access token types can be defined in one of two ways: registered in the A SR aoa R eek ee na? ss Token Types registry (following the procedures in Types utilizing a URI name SHOULD be limited to vendor-specific implementations that are not commonly applicable, and are specific (o the implementation details of the resource server where they are used, All other types MUST be registered. Type names MUST conform to the type-name ABNF. If the type definition includes a new HTTP authentication scheme, the type name SHOULD be identical to the HTTP authentication scheme name (as defined by RFC2617). The token type “example” is reserved for use in examples, mn DETR uaU TOT New request or response parameters for use with the authorization endpoint or the token endpoint are defined and registered in the OAuth Parameters registry following the procedure in Section 11.2. ee US Ree ee cae NOS Roe ere eee ME reference to the syntax of an existing parameter) Loe Sy Wea Unregistered vendor-specifie parameter extensions that are not commonly applicable and that are specific to the implementation details of the authorization server where they are used SHOULD utilize a vendor-specitic prefix that is not likely to conflict with other ree eee ee ke Se) DET ne Ce enn od New authorization grant types can be defined by assigning them a unique absolute URI for use with the "grant_type" parameter. If the extension grant type requires additional token endpoint parameters, they MUST be registered in the OAuth Parameters registry as Pee acne) De aC oT Ty New response types for use with the authorization endpoint are defined and registered in the Authorization Endpoint Response Types ea eee ee eM oe ae eRe er eee CNY ee ee eee) eet a Caran Ifa response type contains one or more space characters (°%x20), itis compared as a space-delimited list of values in which the order of Se ee LR Caan eae ere eRe eee ck ea For example, the response type "token code” is left undefined by this specification. However, an extension can define and register the "token code” response type. Once registered, the same combination cannot be registered as "code token", but both values can be used to denote the same response type. Defining Additional Error Codes In cases where protocol extensions (i.c., access token types, extension parameters, or extension grant types) require additional error codes to be used with the authorization code grant error response (Section 4.1.2.1), the implicit grant error response (Section 4.2.2.1), the token error response (Section 5.2), of the resource access ertor response (Section 7.2), such error codes MAY be defined. Extension error codes MUST be registered (following the procedures in Section 11.4) if the extension they are used in conjunction with is a registered access token type, a registered endpoint parameter, or an extension grant type. Error codes used with unregistered SONNE artes Error codes MUST conform to the etror ABNF and SHOULD be prefixed by an identifying name when possible. For example, an error identifying an invalid value set to the extension parameter "example" SHOULD be named "example_invalid”. ee er eee eters BUN Cen Se nee kee RUC Eco CR en Rn Lee Ea LR application). Native applications require special consideration related to security, platform capabilities, and overall end-user experience. The authorization endpoint requires interaction between the client and the resource owner's user-agent. Native applications can invoke an extemal user-agent or embed a user-agent within the application. For example: o External user-agent - the native application can capture the eck eee een Sree eae Reem nen eae ere sees ee eet ee ae tea Beesesbee nes pares sttweerstener Ty o Embedded user-agent - the native application obtains the response Beare Rec nee ay ronitoring state changes enitted during the resource load, or When choosing between an external or embedded user-agent, developers should consider the following: Pee ea oe ed aCe on ed Peoce ct ear eee hen. prereset cement meee Perea) o An embedded user-agent may offer improved usability, as it removes o An embedded user-agent poses a security challenge because resource comers are authenticating in an unidentified window without access ee eran e eter eee eee este) Sooner once When choosing between the implicit grant type and the authorization code grant type, the following should be considered: EE eon Ce ees reas o When using the implicit grant type flow, a refresh token is not eee sis OSS Re As a flexible and extensible framework, OAuth's security considerations depend on many factors. The following sections provide implementers with security guidelines focused on the three client profiles described in Section 2.1: web application, user-agent-based. Snes A comprehensive OAuth security model and analysis, as well as background for the protocol design, is provided by [OAuth- eT MEN COS 0 ee TEU The authorization server establishes client credentials with web application clients for the purpose of client authentication. The authorization server is encouraged to consider stronger client authentication means than a client password. Web application clients MUST ensure confidentiality of client passwords and other client credentials The authorization server MUST NOT issue client passwords or other client credentials to native application or user-agent-based application clients for the purpose of client authentication, The authorization server MAY issue a client password or other credentials for a specific installation of a native application client on a specific device. STS ee eC RCE aces OU Ren ORS ee ORE Cen es ere Seng example, by requiring the registration of the client redirection URI or enlisting the resource owner to confirm identity. A valid redirection URI is not sufficient to verify the client's identity when asking for resource owner authorization but can be used to prevent delivering Se eer ee ee ae ran The authorization server must consider the security implications of interacting with unauthenticated clients and take measures to limit the potential exposure of other credentials (c-g., refresh tokens) issued to such clients 10.2. Client Impersonation A malicious client can impersonate another client and obtain access to protected resources if the impersonated client fails to, or is unable Rees eee renner The authorization server MUST authenticate the client whenever possible. If the authorization server cannot authenticate the client due to the client's nature, the authorization server MUST require the registration of any redirection URI used for receiving authorization responses and SHOULD utilize other means to protect resource owners from such potentially malicious clients. For example, the authorization server can engage the resource owner to assist in identifying the client and its origin. The authorization server SHOULD enforce explicit resouree owner authentication and provide the resource owner with information about the client and the requested authorization scope and lifetime, It is up to the resource owner to review the information in the context Sere econ ona! The authorization server SHOULD NOT process repeated authorization requests automatically (without active resource owner interaction) without authenticating the client or relying on other measures to ensure that the repeated request comes from the original client and not an impersonator. Tew esac Access token credentials (as well as any confidential access token attributes) MUST be kept confidential in transit and storage, and only shared among the authorization server, the resource servers the access token is valid for, and the client to whom the access token is issued. Access token credentials MUST only be transmitted using TLS as described in Section 1.6 with server authentication as defined Dane Sea eee eee CR CTR eee eee eR The authorization server MUST ensure that access tokens cannot be generated, modified, or guessed to produce valid access tokens by rt The client SHOULD request access tokens with the minimal scope necessary. The authorization server SHOULD take the client identity into account when choosing how to honor the requested scope and MAY issue an access token with less rights than requested. This specification does not provide any methods for the resource server to ensure that an access token presented to it by a given client was issued to that client by the authorization server. ee ore wey Authorization servers MAY issue refresh tokens to web application clients and native application clients. Reffesh tokens MUST be kept confidential in transit and storage, and shared only among the authorization server and the client to whom the refresh tokens were issued. The authorization server MUST maintain the binding between a refresh token and the client to whom it was issued. Refresh tokens MUST only be transmitted using TLS as described in Section 1.6 with server authentication as defined by RFC2818, The authorization server MUST verify the binding between the refresh token and client identity whenever the client identity can be authenticated, When client authentication is not possible, the authorization server SHOULD deploy other means to detect refresh token aa eas UE eae Ue a eR ee BL ROS cS refresh response. The previous refresh token is invalidated but retained by the authorization server. Ifa refresh token is compromised and subsequently used by both the attacker and the legitimate client, one of them will present an invalidated refresh token, which will inform the authorization server of the breach. The authorization server MUST ensure that refresh tokens cannot be generated, modified, or guessed to produce valid refresh tokens by ie te Oe rsa tenn cs The transmission of authorization codes SHOULD be made over a secure channel, and the client SHOULD require the use of TLS with. its redirection URI if the URI identifies a network resource. Since authorization codes are transmitted via user-agent redirections, they could potentially be disclosed through user-agent history and HTTP referrer headers. Authorization codes operate as plaintext bearer credentials, used to verify that the resource owner who granted authorization at the authorization server is the same resource owner returning to the client to complete the process. Therefore, if the client relies on the authorization code for its own resource owner authentication, the client reditection endpoint MUST require the use of TLS. Authorization codes MUST be short lived and single-use. If the authorization server observes multiple attempts to exchange an authorization code for an access token, the authorization server SHOULD attempt to revoke all access tokens already granted based on the compromised authorization code. Ifthe client can be authenticated, the authorization servers MUST authenticate the client and ensure that the authorization code was Ree Te Res enc ACCU Ta When requesting authorization using the authorization code grant type, the client can specify a redirection URI via the "redirect_ui" parameter. If an attacker can manipulate the value of the redirection URI, it can cause the authorization server to redirect the resource owner user-agent to a URI under the control of the attacker with the authorization code, ROE eee Ree ee UE er ee tee ee eee Cae ee eo authorization server to grant access, the attacker grabs the authorization URI provided by the legitimate client and replaces the client's redirection URI with a URI under the control of the attacker. The attacker then tricks the vietim into following the manipulated link to authorize access to the legitimate client. Once at the authorization server, the victim is prompted with a normal, valid request on behalf of a legitimate and trusted client, and authorizes the request. The victim is then redirected to an endpoint under the control of the attacker with the authorization code. The attacker completes the authorization flow by sending the authorization code to the client using the original redirection URI provided by the client. The client exchanges the authorization code with an access token and links it to the attacker's client account, which can now gain access to the protected resources authorized by the victim (via the client). In order to prevent such an attack, the authorization server MUST ensure that the redirection URI used to obtain the authorization code is identical to the redirection URI provided when exchanging the authorization code for an access token. The authorization server MUST requite public clients and SHOULD require confidential clients to register their redirection URIS. If a redirection URI is provided in the request, the authorization server MUST validate it against the registered value. 10.7. Resource Owner Password Credentials The resource owner password credentials grant type is often used for legacy or migration reasons. It reduces the overall risk of storing usemames and passwords by the client but does not eliminate the need to expose highly privileged credentials to the client. This grant type carries a higher risk than other grant types because it maintains the password anti-pattem this protocol seeks to avoid, Tee Ee ee eC en a ete cree ec omer Additionally, because the resource owner does not have control over the authorization process (the resource owner's involvement ends when it hands over its credentials to the client), the client can obtain access tokens with a broader scope than desired by the resource owner. The authorization server should consider the scope and lifetime of access tokens issued via this grant type. The authorization server and client SHOULD minimize use of this grant type and utilize other grant types whenever possible. a cere cence ig Access tokens, refresh tokens, resource owner passwords, and client credentials MUST NOT be transmitted in the clear. Authorization STS ODIO erent Renae cs DU Oe On ee ele en OUL ESE Uk RA ORS transmitted over insecure channels or stored insecurely. ae ecg In order to prevent man-in-the-middle attacks, the authorization server MUST require the use of TLS with server authentication as defined by RFC2818 for any request sent to the authorization and token endpoints. The client MUST validate the authorization server's TLS certificate as defined by RFC612S and in accordance with its requirements for server identity authentication. MS UMert ert meee te The authorization server MUST prevent attackers from guessing access tokens, authorization codes, refresh tokens, resource owner passwords, and client credentials. The probability of an attacker guessing generated tokens (and other credentials not intended for handling by end-users) MUST be less ere Pere ue set set Pel) The authorization server MUST utilize other means to protect credentials intended for end-user usage, TSTMS e co Wide deployment of this and similar protocols may cause end-users to become inured to the practice of being redirected to websites, where they are asked to enter their passwords. If end-users are not careful to verify the authenticity of these websites before entering their credentials, it will be possible for attackers to exploit this practice to steal resource owners’ passwords. Service providers should attempt to educate end-users about the risks phishing attacks pose and should provide mechanisms that make it casy for end-users to confirm the authenticity of their sites. Client developers should consider the security implications of how they interact with the user-agent (e.g., external, embedded), and the ability of the end-user to verify the authenticity of the authorization eared To reduce the risk of phishing attacks, the authorization servers MUST require the use of TLS on every endpoint used for end-user interaction, OREM encase ees ad Cross-site request forgery (CSRF) is an exploit in which an attacker causes the user-agent of a victim end-user to follow a malicious URI (c.g., provided to the user-agent as a misleading link, image, or redirection) to a trusting server (usually established via the presence of a valid session cookie). A CSRF attack against the client's redirection URI allows an attacker to inject its own authorization code or access token, which can result in the client using an access token associated with the attacker's protected resources rather than the vietim’s (¢.g., save the victim's bank account information to a protected resource controlled by the attacker) The client MUST implement CSRF protection for its redirection URI. This is typically accomplished by requiring any request sent to the redirection URI endpoint to include a value that binds the request to the user-agent's authenticated state (e.g., a hash of the session cookie used to authenticate the user-agent). The client SHOULD utilize the "state" request parameter to deliver this value to the authorization ee eer ete Once authorization has been obtained from the end-user, the authorization server redirects the end-user's user-agent back to the client with the required binding value contained in the "state" parameter. The binding value enables the client to verify the validity of the request by matching the binding value to the user-agent's authenticated state. The binding value used for CSRE protection MUST contain See eRe ce ee ee meen are) storage) MUST be kept in a location accessible only to the client and the user-agent (i.., protected by same-origin policy), A CSRF attack against the authorization server's authorization endpoint can result in an attacker obtaining end-user authorization for a malicious client without involving or alerting the end-user The authorization server MUST implement CSRF protection for its authorization endpoint and ensure that a malicious client cannot obtain authorization without the awareness and explicit consent of the resource owner. 10.13. Clickjacking Ina clickjacking attack, an attacker registers a legitimate client and then constructs a malicious site in which it loads the authorization server's authorization endpoint web page in a transparent iframe overlaid on top of a set of dummy buttons, which are carefully constructed to be placed directly under important buttons on the authorization page. When an end-user clicks a misleading visible button, the end-user is actually clicking an invisible button on the authorization page (such as an "Authorize" button). This allows an attacker to trick a resource owner into granting its elient access without the end-user's knowledge. OE RE Se ele ee ona Rea aR RULE Ue when requesting end-user authorization, For most newer browsers, avoidance of iframes can be enforced by the authorization server using the (non-standard) "x-frame-options” header. This header can have two values, "deny" and "sameorigin”, which will block any framing, or framing by sites with a different origin, respectively. For older browsers, JavaScript frame-busting techniques can be used but DSc ee TRC Mec es ere RL A code injection attack occurs when an input or otherwise external variable is used by an application unsanitized and causes modification to the application logic. This may allow an attacker to gain access to the application device or its data, cause denial of service, or De eR eens as The authorization server and client MUST sanitize (and validate when possible) any value received ~ in particular, the value of the "state" and "redirect_uri" parameters RCRD certs The authorization server, authorization endpoint, and client redirection endpoint can be improperly configured and operate as open redirectors. An open redirector is an endpoint using a parameter to automatically redirect a user-agent to the location specified by the SR RUC) Open redirectors can be used in phishing attacks, or by an attacker to get end-users to visit malicious sites by using the URI authority component of a familiar and trusted destination. In addition, if the authorization server allows the client to register only part of the redirection URI, an attacker can use an open redirector operated by the client to construct a redirection URI that will pass the authorization server validation but will send the authorization code or access token to an endpoint under the control of the attacker. 10.16. Misuse of Access Token to Impersonate Resource Owner in Implicit ey For public clients using implicit flows, this specification does not provide any method for the client to determine what client an access token was issued to. ee ea AO eo Ce ee Eee gee ee CRO EC Cerne ence mend due to phishing or some other pretext. An attacker may also steal a token via some other mechanism. An attacker may then attempt to impersonate the resource owner by providing the access token to a legitimate public client In the implicit flow (response_type-token), the attacker can easily switch the token in the response from the authorization server, replacing the real access token with the one previously issued to the attacker. Servers communicating with native applications that rely on being passed an access token in the back channel to identify the user of the client may be similarly compromised by an attacker creating a compromised application that can inject arbitrary stolen access tokens. Any public client that makes the assumption that only the resource owner can present it with a valid access token for the resource is COR kone This type of attack may expose information about the resource owner at the legitimate client to the attacker (malicious client). This will also allow the attacker to perform operations at the legitimate client with the same permissions as the resource owner who originally Sen eee ke aero Authenticating resource owners to clients is out of scope for this specification. Any specification that uses the authorization process as a form of delegated end-user authentication to the client (c.g., third-party sign-in service) MUST NOT use the implicit flow without additional security mechanisms that would enable the client to determine if the access token was issued for its use (e.g., audience- restricting the access token) TN eS Seay 11.1, OAuth Access Token Types Registry This specification establishes the OAuth Access Token Types registry. Access token types are registered with a Specification Required (RFC5226) after a two-week review period on the oauth-ext- review @ietf.org mailing list, on the advice of one or more Designated Experts. However, to allow for the allocation of values prior to publication, the Designated Expert(s) may approve registration once they are satisfied that such a specification will be published. ee hee eo eC ee cl REE Seas en (e-g., "Request for access token type: example”), Within the review period, the Designated Expert(s) will either approve or deny the registration request, communicating this decision to the review list and IANA. Denials should include an explanation and, if applicable, suggestions as to how to make the request successful IANA must only accept registry updates from the Designated Expert(s) and should direct all requests for registration to the review nae Tee Cramton Ny Se eee ce ere Additional Token Endpoint Response Parameters: Re a ae meres ey Section 12.2, HTTP Authentication Scheme(s): See eo eens) eee Pecoraro oe oie neon pe ie eaieeenear tier eet str Seen co) feterence to the docunent(s) that specify the paraneter, er ae resent eect oe testes ets encarta} eRe Cen Cd This specification establishes the OAuth Parameters registry. Additional parameters for inclusion in the authorization endpoint request, the authorization endpoint response, the token endpoint request, or the token endpoint response are registered with a Specification Required (RFC5226) after a two-week review period on the TTT Ee Or a ee ee me cd prior to publication, the Designated Expert(s) may approve registration once they are satisfied that such a specification will be published. Registration requests must be sent to the oauth-ext-review@ietf.org mailing list for review and comment, with an appropriate subject (e.g., "Request for parameter: example") Within the review period, the Designated Expert(s) will either approve or deny the registration request, communicating this decision to the review list and [ANA. Denials should include an explanation and, if applicable, suggestions as to how to make the request successful [ANA must only accept registry updates from the Designated Expert(s) and should direct all requests for registration to the review ma Tee Cee earn eee De Roa e Parameter usage location: Seer e Renee ec a aero? ere ee ae eae ed ear egbeihee SPeeneame rar rere rae ered eS earner nents et Seen eo Aeterence to the document(s) that specify the paraneter, OMe eerste es Sets cen aro) 11.2.2. Initial Registry Contents The OAuth Parameters registry's initial contents are o Parameter name: client_id o Parameter usage location: authorization request, token request o Change controller: IETF o Specification document(s): RFC 6749 o Parameter name: client_secret o Parameter usage location: token request 0 Change controller: IETF o Specification document(s): RFC 6749 o Parameter name: response_type o Parameter usage lo OB eRIEEy tion: authorization request o Change controller: IETF 0 Specification o Parameter name: redirect_uri o Parameter usage location: authorization request, token request 0 Change controller: IETF 0 Specification document(s): RFC 6749 See ec s Cece eCeeae e eens 0 Change controller: IETF o Specification document(s): RFC 6749 Se eC ea ree eee ee TTT 0 Change controller: IETF o Specification document(s): RFC 6749 o Parameter name: code o Parameter usage location: authorization response, token request o Change controller: IETF o Specification document(s): RFC 6749 o Parameter name: error_description o Parameter usage location: authorization response, token response o Change controller: IETF 0 Specification document(S): RFC 6749 o Parameter name: error_uri o Parameter usage location: authorization response, token response o Change controller: IETF 0 Specification document(s): RFC 6749 o Parameter name: grant_type o Parameter usage location: token request o Change controller: IETF o Specification document(s): REC 6749 o Parameter name: access_token o Parameter usage location: authorization response, token response o Change controller: IETF 0 Specification document(s): RFC 6749 o Parameter name: token_type o Parameter usage location: authorization response, token response o Change controller: IETF 0 Specification document(s): REC 6749 o Parameter name: expires_in o Parameter usage location: authorization response, token response o Change controller: IETF 0 Specification document(s): RFC 6749

Você também pode gostar