One document matched: draft-ietf-oauth-v2-bearer-02.xml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<rfc category='std' ipr='trust200902' docName='draft-ietf-oauth-v2-bearer-02'>
<?rfc strict='yes' ?>
<?rfc toc='yes' ?>
<?rfc tocdepth='3' ?>
<?rfc symrefs='yes' ?>
<?rfc sortrefs='yes' ?>
<?rfc compact='yes' ?>
<?rfc subcompact='no' ?>
<front>
<title abbrev='OAuth 2.0 Bearer Tokens'>The OAuth 2.0 Protocol: Bearer Tokens</title>
<author fullname="Michael B. Jones" surname="Jones" initials="M.B."> <!-- role="editor" -->
<organization>Microsoft</organization>
<address>
<email>mbj@microsoft.com</email>
<uri>http://self-issued.info/</uri>
</address>
</author>
<author fullname='Dick Hardt' surname='Hardt' initials='D'>
<organization>independent</organization>
<address>
<email>dick.hardt@gmail.com</email>
<uri>http://dickhardt.org/</uri>
</address>
</author>
<author fullname='David Recordon' surname='Recordon' initials='D'>
<organization>Facebook</organization>
<address>
<email>dr@fb.com</email>
<uri>http://www.davidrecordon.com/</uri>
</address>
</author>
<date year="2011" month="January" day="28" />
<abstract>
<t>
This specification describes how to use bearer tokens when accessing OAuth 2.0
protected resources.
</t>
</abstract>
</front>
<middle>
<section title='Introduction'>
<t>
OAuth enables clients to access protected resources by
obtaining an access token, which is defined in <xref
target="OAuth2"/> as "a string representing an access
authorization issued to the client", rather than using the
resource owner's credentials.
</t>
<t>
Tokens are issued to clients by an authorization server with the approval of
the resource owner. The client uses the access token to access the protected resources
hosted by the resource server. This specification describes how to make protected resource
requests by treating an OAuth access token as a bearer token.
</t>
<t>
This specification defines the use of bearer tokens with OAuth
over <xref target='RFC2616'>HTTP</xref> using <xref
target='RFC2818'>TLS</xref>. Other specifications may extend
it for use with other transport protocols.
</t>
<section title='Notational Conventions'>
<t>
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 <xref target='RFC2119' />.
</t>
<t>
This document uses the Augmented Backus-Naur Form (ABNF)
notation of <xref target='I-D.ietf-httpbis-p1-messaging'
/>. Additionally, the following rules are included from
<xref target='RFC2617' />: auth-param; and from <xref
target='I-D.ietf-httpbis-p1-messaging' />: RWS.
</t>
<t>
Unless otherwise noted, all the protocol parameter names and values are case sensitive.
</t>
</section>
<section title='Terminology'>
<t>
All terms are as defined in <xref target="OAuth2" />.
</t>
</section>
<section title='Overview'>
<t>
OAuth provides a method for clients to access a protected resource on behalf of a
resource owner. Before a client can access a protected resource, it must first obtain
authorization (access grant) from the resource owner and then exchange the access grant for
an access token (representing the grant's scope, duration, and other attributes). The
client accesses the protected resource by presenting the access token to the resource
server.
</t>
<t>
The access token provides an abstraction layer, replacing different authorization
constructs (e.g. username and password, assertion) for a single token understood by the
resource server. This abstraction enables issuing access tokens valid for a short time
period, as well as removing the resource server's need to understand a wide range of
authentication schemes.
</t>
<figure title='Abstract Protocol Flow' anchor='Figure 1'>
<artwork>
<![CDATA[+--------+ +---------------+
| |--(A)- Authorization Request ->| Resource |
| | | Owner |
| |<-(B)----- Access Grant -------| |
| | +---------------+
| |
| | Access Grant & +---------------+
| |--(C)--- Client Credentials -->| Authorization |
| Client | | Server |
| |<-(D)----- Access Token -------| |
| | +---------------+
| |
| | +---------------+
| |--(E)----- Access Token ------>| Resource |
| | | Server |
| |<-(F)--- Protected Resource ---| |
+--------+ +---------------+]]>
</artwork>
</figure>
<t>
The abstract flow illustrated in <xref target='Figure 1' /> describes the overall
OAuth 2.0 protocol architecture. The following steps are specified within this
document:
<list>
<t>
E) The client makes a protected resource request to the resource server by presenting
the access token.
</t>
<t>
F) The resource server validates the access token, and if valid, serves the request.
</t>
</list>
</t>
</section>
</section>
<section title='Authenticated Requests'>
<t>
Clients make authenticated token requests using the
<spanx style='verb'>Authorization</spanx> request header field. Resource servers MUST
accept authenticated requests using the <spanx style='verb'>OAuth2</spanx> HTTP
authentication scheme as described in <xref target='authz-header' />, and MAY support
additional methods.
</t>
<t>
Alternatively, clients MAY attempt to include the access token
in the HTTP body when using the <spanx
style='verb'>application/x-www-form-urlencoded</spanx> content
type as described in <xref target='body-param' /> or using the
HTTP request URI in the query component as described in <xref
target='query-param' />. Resource servers MAY support these
alternative methods.
</t>
<t>
Clients SHOULD only use the request body or URI when the
<spanx style='verb'>Authorization</spanx> request header field
is not available, and MUST NOT use more than one method to
transport the token in each request. Because of the <xref
target="sec-con">Security Considerations</xref> associated
with the URI method, it SHOULD only be used if no other method
is feasible.
</t>
<section title='The Authorization Request Header Field' anchor='authz-header'>
<t>
The <spanx style='verb'>Authorization</spanx> request header field is used by clients
to make authenticated token requests. The client uses the
<spanx style='verb'>OAuth2</spanx> authentication scheme to include the access token in
the request.
</t>
<figure>
<preamble>
For example:
</preamble>
<artwork>
<![CDATA[GET /resource HTTP/1.1
Host: server.example.com
Authorization: OAuth2 vF9dft4qmT]]>
</artwork>
</figure>
<t>
The <spanx style='verb'>Authorization</spanx> header field uses the framework defined by
<xref target='RFC2617' /> as follows:
</t>
<figure>
<artwork>
<![CDATA[credentials = "OAuth2" RWS access-token [ RWS 1#auth-param ]
access-token = 1*( quoted-char / <"> )
quoted-char = "!" / "#" / "$" / "%" / "&" / "'" / "("
/ ")" / "*" / "+" / "-" / "." / "/" / DIGIT
/ ":" / "<" / "=" / ">" / "?" / "@" / ALPHA
/ "[" / "]" / "^" / "_" / "`" / "{" / "|"
/ "}" / "~" / "\" / "," / ";"]]>
</artwork>
</figure>
</section>
<section title='Form-Encoded Body Parameter' anchor='body-param'>
<t>
When including the access token in the HTTP request entity-body, the client adds the
access token to the request body using the <spanx style='verb'>oauth_token</spanx>
parameter. The client can use this method only if the following REQUIRED conditions are
met:
<list style='symbols'>
<t>
The HTTP request entity-body is single-part.
</t>
<t>
The entity-body follows the encoding requirements of the
<spanx style='verb'>application/x-www-form-urlencoded</spanx> content-type as
defined by <xref target='W3C.REC-html401-19991224' />.
</t>
<t>
The HTTP request entity-header includes the <spanx style='verb'>Content-Type</spanx>
header field set to <spanx style='verb'>application/x-www-form-urlencoded</spanx>.
</t>
<t>
The HTTP request method is one for which a body is
permitted to be present in the request. In particular,
this means that the <spanx style='verb'>GET</spanx>
method MAY NOT be used.
</t>
</list>
</t>
<t>
The entity-body can include other request-specific parameters, in which case, the
<spanx style='verb'>oauth_token</spanx> parameters SHOULD be appended following the
request-specific parameters, properly separated by an <spanx style='verb'>&</spanx>
character (ASCII code 38).
</t>
<figure>
<preamble>
For example, the client makes the following HTTP request using transport-layer
security:
</preamble>
<artwork>
<![CDATA[POST /resource HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
oauth_token=vF9dft4qmT]]>
</artwork>
</figure>
<t>
The <spanx
style='verb'>application/x-www-form-urlencoded</spanx> method
should typically only be used in application contexts where
participating browsers do not have access to the <spanx
style='verb'>Authorization</spanx> request header field.
</t>
</section>
<section title='URI Query Parameter' anchor='query-param'>
<t>
When including the access token in the HTTP request URI, the client adds the access
token to the request URI query component as defined by <xref target='RFC3986' /> using
the <spanx style='verb'>oauth_token</spanx> parameter.
</t>
<figure>
<preamble>
For example, the client makes the following HTTP request using transport-layer
security:
</preamble>
<artwork>
<![CDATA[GET /resource?oauth_token=vF9dft4qmT HTTP/1.1
Host: server.example.com]]>
</artwork>
</figure>
<t>
The HTTP request URI query can include other request-specific parameters, in which
case, the <spanx style='verb'>oauth_token</spanx> parameters SHOULD be appended
following the request-specific parameters, properly separated by an
<spanx style='verb'>&</spanx> character (ASCII code 38).
</t>
<figure>
<preamble>
For example:
</preamble>
<artwork>
<![CDATA[http://example.com/resource?x=y&oauth_token=vF9dft4qmT]]>
</artwork>
</figure>
<t>
Because of the <xref target="sec-con">Security
Considerations</xref> associated with the URI method, it
SHOULD only be used if no other method is feasible.
</t>
</section>
</section>
<section title='Security Considerations' anchor="sec-con">
<t>
This section describes the relevant security threats regarding
token handling when using bearer tokens and describes how to
mitigate these threats.
</t>
<section anchor="threats" title="Security Threats">
<t>
The following list presents several common threats against
protocols utilizing some form of tokens. This list of
threats is based on NIST Special Publication 800-63 <xref
target="NIST800-63"/>. Since this document builds on the
OAuth 2.0 specification, we exclude a discussion of threats
that are described there or in related documents.
</t>
<t>
<list style="hanging">
<t hangText="Token manufacture/modification:">
An attacker may generate a bogus token or modify the
token contents (such as the authentication or attribute
statements) of an existing token, causing the resource
server to grant inappropriate access to the client.
For example, an attacker may modify the token to extend
the validity period; a malicious client may modify the
assertion to gain access to information that they
should not be able to view.
</t>
<t hangText="Token disclosure:">
Tokens may contain authentication and attribute
statements that include sensitive information.
</t>
<t hangText="Token redirect:">
An attacker uses the token generated for consumption by
resource server to obtain access to another resource
server.
</t>
<t hangText="Token replay:">
An attacker attempts to use a token that has already
been used with that resource server in the past.
</t>
</list>
</t>
</section>
<section anchor="mitigation" title="Threat Mitigation">
<t>
A large range of threats can be mitigated by protecting the
contents of the token by using a digital signature or a
keyed message digest. Alternatively, the contents of the
token could be passed by reference rather than by value
(requiring a separate message exchange to resolve the
reference to the token contents).
</t>
<t>
This document does not specify the encoding or the contents
of the token; hence detailed recommendations for token
integrity protection are outside the scope of this document.
We assume that the token integrity protection is sufficient
to prevent the token from being modified.
</t>
<t>
To deal with token redirect, it is important for the
authorization server to include the identity of the intended
recipients, namely a single resource server (or a list of
resource servers). Restricting the use of the token to a
specific scope is also recommended.
</t>
<t>
To provide protection against token disclosure,
confidentiality protection is applied via TLS with a
ciphersuite that offers confidentiality protection. This
requires that the communication interaction between the
client and the authorization server, as well as the
interaction between the client and the resource server,
utilize confidentiality protection.
Since TLS is mandatory to
implement and to use with this specification, it is the
preferred approach for preventing token disclosure via the
communication channel. For those cases where the client
is prevented from observing the contents of the token, token
encryption has to be applied in addition to the usage of TLS
protection.
</t>
<t>
To deal with token capture and replay,
the following recommendations are
made: First, the lifetime of the token has to be limited by
putting a validity time field inside the protected part of
the token. Note that using short-lived (one hour or less)
tokens significantly reduces the impact of one of them being
leaked. Second, confidentiality protection of the exchanges
between the client and the authorization server and between
the client and the resource server MUST be applied. As a
consequence, no eavesdropper along the communication path is
able to observe the token exchange. Consequently, such an
on-path adversary cannot replay the token.
Furthermore, when
presenting the token to a resource server, the client MUST
verify the identity of that resource server. Note that the
client MUST validate the TLS certificate chain when making
these requests to protected resources. Presenting the token
to an unauthenticated and unauthorized resource server or
failing to validate the certificate chain will allow
adversaries to steal the token and gain unauthorized access
to protected resources.
</t>
</section>
<section title="Summary of Recommendations">
<t>
<list style="hanging">
<t hangText="Safeguard bearer tokens">
Client implementations MUST ensure that bearer tokens
are not leaked to unintended parties, as they will be
able to use them to gain access to protected resources.
This is the primary security consideration when using
bearer tokens with OAuth and underlies all the more
specific recommendations that follow.
</t>
<t hangText="Validate SSL certificate chains">
The client must validate the TLS certificate chain when
making requests to protected resources. Failing to do
so may enable DNS hijacking attacks to steal the token
and gain unintended access.
</t>
<t hangText="Always use TLS (https)">
Clients MUST always use TLS (https) when making requests
with bearer tokens. Failing to do so exposes the token
to numerous attacks that could give attackers unintended
access.
</t>
<t hangText="Don't store bearer tokens in cookies">
As cookies are generally sent in the clear,
implementations MUST NOT store bearer tokens within
them.
</t>
<t hangText="Issue short-lived bearer tokens">
Using short-lived (one hour or less) bearer tokens can
reduce the impact of one of them being leaked. The
User-Agent flow should only issue short lived access
tokens.
</t>
<t hangText="Don't pass bearer tokens in page URLs">
Browsers, web servers, and other software may not
adequately secure URLs in the browser history, web
server logs, and other data structures. If bearer
tokens are passed in page URLs (typically as query
string parameters), attackers might be able to steal
them from the history data, logs, or other unsecured
locations. Instead, pass browser tokens in message
bodies for which confidentiality measures are taken.
</t>
</list>
</t>
</section>
</section>
<section title='IANA Considerations'>
<section title='OAuth Access Token Type Registration'>
<t>
This specification registers the following access token type in the OAuth Access Token
Type Registry.
</t>
<section title='The "OAuth2" OAuth Access Token Type'>
<t>
<list style='hanging'>
<t hangText='Type name:'>
<vspace />
OAuth2
</t>
<t hangText='Additional Token Request Parameters:'>
<vspace />
oauth_token
</t>
<t hangText='HTTP Authentication Scheme(s):'>
<vspace />
OAuth2
</t>
<t hangText='Change controller:'>
<vspace />
IETF
</t>
<t hangText='Specification document(s):'>
<vspace />
[[ this document ]]
</t>
</list>
</t>
</section>
</section>
<section title='OAuth Parameters Registration'>
<t>
This specification registers the following parameters in the OAuth Parameters Registry
established by <xref target="OAuth2" />.
</t>
<section title='The "oauth_token" OAuth Parameter'>
<t>
<list style='hanging'>
<t hangText='Parameter name:'>
oauth_token
</t>
<t hangText='Parameter usage location:'>
Token requests
</t>
<t hangText='Change controller:'>
IETF
</t>
<t hangText='Specification document(s):'>
[[ this document ]]
</t>
<t hangText='Related information:'>
None
</t>
</list>
</t>
</section>
</section>
</section>
</middle>
<back>
<references title='Normative References'>
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml' ?>
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml' ?>
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.2617.xml' ?>
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.2818.xml' ?>
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml' ?>
<?rfc include='http://xml.resource.org/public/rfc/bibxml4/reference.W3C.REC-html401-19991224.xml' ?>
<?rfc include='http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p1-messaging-09.xml'?>
<reference anchor="OAuth2"> <!--TBD What is the correct way to reference the framework specification?-->
<front>
<title>The OAuth 2.0 Protocol Framework</title>
<author fullname='Eran Hammer-Lahav' surname='Hammer-Lahav' initials='E' role='editor'>
<organization>Yahoo!</organization>
<address>
<email>eran@hueniverse.com</email>
<uri>http://hueniverse.com</uri>
</address>
</author>
<author fullname='David Recordon' surname='Recordon' initials='D'>
<organization>Facebook</organization>
<address>
<email>dr@fb.com</email>
<uri>http://www.davidrecordon.com/</uri>
</address>
</author>
<author fullname='Dick Hardt' surname='Hardt' initials='D'>
<organization>Microsoft</organization>
<address>
<email>dick.hardt@gmail.com</email>
<uri>http://dickhardt.org/</uri>
</address>
</author>
<date year='2011' />
</front>
</reference>
</references>
<references title="Informative References">
<reference anchor="NIST800-63">
<front>
<title>NIST Special Publication 800-63-1, INFORMATION SECURITY</title>
<author fullname="William E. Burr" initials="W." surname="Burr">
<organization>NIST</organization>
</author>
<author fullname="Donna F. Dodson" initials="D." surname="Dodson">
<organization>NIST</organization>
</author>
<author fullname="Ray A. Perlner" initials="R." surname="Perlner">
<organization>NIST</organization>
</author>
<author fullname="W. Timothy Polk" initials="T." surname="Polk">
<organization>NIST</organization>
</author>
<author fullname="Sarbari Gupta" initials="S." surname="Gupta">
<organization>NIST</organization>
</author>
<author fullname="Emad A. Nabbus" initials="E." surname="Nabbus">
<organization>NIST</organization>
</author>
<date month="December" year="2008"/>
</front>
<format target="http://csrc.nist.gov/publications/PubsDrafts.html#SP-800-63-Rev.%201" type="HTML"/>
</reference>
</references>
<section title='Acknowledgements'>
<t>
The following people contributed to preliminary versions of this document:
Blaine Cook (BT), Brian Eaton (Google), Yaron Goland (Microsoft), Brent Goldman (Facebook),
Raffi Krikorian (Twitter), Luke Shepard (Facebook), and Allen Tom (Yahoo!). The content and
concepts within are a product of the OAuth community, the WRAP community, and the OAuth Working
Group.
</t>
<t>
The OAuth Working Group has dozens of very active contributors who proposed ideas and
wording for this document, including:
Michael Adams, Andrew Arnott, Dirk Balfanz, Brian Campbell, Leah Culver, Bill de hÓra,
Brian Ellin, Igor Faynberg, George Fletcher, Tim Freeman, Evan Gilbert, Justin Hart,
John Kemp, Eran Hammer-Lahav, Chasen Le Hara, Michael B. Jones, Torsten Lodderstedt,
Eve Maler, James Manger, Laurence Miao,
Chuck Mortimore, Anthony Nadalin, Justin Richer, Peter Saint-Andre, Nat Sakimura, Rob Sayre,
Marius Scurtescu, Naitik Shah, Justin Smith, Jeremy Suriel, Christian Stübner, Paul Tarjan,
and Franklin Tse.
</t>
</section>
<section title='Document History'>
<t>
[[ to be removed by RFC editor before publication as an RFC ]]
</t>
<t>
-02
<list style='symbols'>
<t>
Incorporated feedback received on draft 01. Most changes
were to the security considerations section. No normative
changes were made. Specific changes included:
</t>
<t>
Changed terminology from "token reuse" to "token capture
and replay".
</t>
<t>
Removed sentence "Encrypting the token contents is another
alternative" from the security considerations since it was
redundant and potentially confusing.
</t>
<t>
Corrected some references to "resource server" to be
"authorization server" in the security considerations.
</t>
<t>
Generalized security considerations language about
obtaining consent of the resource owner.
</t>
<t>
Broadened scope of security considerations description for
recommendation "Don't pass bearer tokens in page URLs".
</t>
<t>
Removed unused reference to OAuth 1.0.
</t>
<t>
Updated reference to framework specification and updated
David Recordon's e-mail address.
</t>
<t>
Removed security considerations text on authenticating
clients.
</t>
<t>
Registered the "OAuth2" OAuth access token type and
"oauth_token" parameter.
</t>
</list>
</t>
<t>
-01
<list style='symbols'>
<t>
First public draft, which incorporates feedback received
on -00 including enhanced Security Considerations content.
This version is intended to accompany OAuth 2.0 draft 11.
</t>
</list>
</t>
<t>
-00
<list style='symbols'>
<t>
Initial draft based on preliminary version of OAuth 2.0 draft 11.
</t>
</list>
</t>
</section>
</back>
</rfc>
| PAFTECH AB 2003-2026 | 2026-04-22 22:34:10 |