<?xml version="1.0" encoding="UTF-8"?>

<!-- [rfced] updated by Chris 05/13/20 --> version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="Trust200902"
     submissionType="IETF" category="std" consensus="true"
     docName="draft-ietf-sipcore-sip-token-authnz-17"
    number="0000" number="8898"
     xml:lang="en" updates="3261" tocInclude="true" symRefs="true"
     sortRefs="true" version="3">

  <!-- xml2rfc v2v3 conversion 2.39.0 -->
  <!-- ********************************** FRONT ********************************** -->
<front>
    <title abbrev="3rd-Party Token-based AuthNZ for SIP"> Token-Based SIP Authentication">
         Third-Party Token-based Token-Based Authentication and Authorization for Session
    Initiation Protocol (SIP)
    </title> (SIP)</title>
    <seriesInfo name="RFC" value="0000"/> value="8898"/>
    <author initials="R." surname="Shekh-Yusef" fullname="Rifaat Shekh-Yusef">
      <organization>Avaya</organization>
      <organization>Auth0</organization>
      <address>
        <postal>
          <street>425 Legget Drive</street>
          <street></street>
          <city>Ottawa</city>
          <region>Ontario</region>
          <country>Canada</country>
        </postal>
        <phone>+1-613-595-9106</phone>
        <email>rifaat.ietf@gmail.com</email>
        <phone></phone>
        <email>rifaat.s.ietf@gmail.com</email>
      </address>
    </author>
    <author initials="C." surname="Holmberg" fullname="Christer Holmberg">
      <organization>Ericsson</organization>
      <address>
        <postal>
          <street>Hirsalantie 11</street>
          <city>Jorvas</city><code>02420</code>
          <city>Jorvas</city>
	  <code>02420</code>
          <region/>
          <country>Finland</country>
        </postal>
        <email>christer.holmberg@ericsson.com</email>
      </address>
    </author>
    <author initials="V." surname="Pascual" fullname="Victor Pascual">
      <organization>webrtchacks</organization>
      <organization>Nokia</organization>
      <address>
        <postal>
          <street/>
          <region/>
          <city>Barcelona</city>
          <country>Spain</country>
        </postal>
        <email>victor.pascual.avila@gmail.com</email>
        <email>victor.pascual_avila@nokia.com</email>
      </address>
    </author>
    <date year="2020" month="May" /> month="September"/>
    <area>RAI</area>
    <workgroup>SIP Core</workgroup>
    <keyword>SIP OAuth</keyword>
    <keyword>3rd party authentication</keyword>
    <keyword>Third party authentication</keyword>
    <abstract>

      <t>
    This document defines the "Bearer" authentication scheme for
    the Session Initiation Protocol (SIP), (SIP) and a mechanism by
    which user authentication and SIP registration authorization
    is delegated to a third party, using the OAuth 2.0 framework
    and OpenID Connect Core 1.0.  This document updates RFC 3261
    to provide guidance on how a SIP User Agent Client (UAC)
    responds to a SIP 401/407 response that contains multiple
    WWW-Authenticate/Proxy-Authenticate header fields.
      </t>
    </abstract>
  </front>
  <!-- ********************************** MIDDLE ********************************** -->
<middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>
      The Session Initiation Protocol (SIP) <xref target="RFC3261"/> uses the same framework
      as HTTP <xref target="RFC7230"/> to authenticate users: a simple
      challenge-response authentication mechanism that allows a SIP User Agent Server (UAS), proxy proxy, or
      registrar to challenge a SIP User Agent Client (UAC) request and allows
      the UAC to provide authentication information in response to that
      challenge.

      </t>
      <t>
      OAuth 2.0 <xref target="RFC6749"/> defines a token-based authorization
      framework to allow an OAuth client to access resources on behalf of its user.
      </t>
      <t>
      The OpenID Connect Core 1.0 specification <xref target="OPENID"/> defines
      a simple identity layer on top of the OAuth 2.0 protocol, which enables
      OAuth/OpenID clients to verify the identity of the user based on the authentication
      performed by a dedicated authorization server (AS), referred to as
      OpenID Provider (OP), as well as to obtain basic profile information about the user.
      </t>
      <t>
      This document defines the "Bearer" authentication scheme for the
      Session Initiation Protocol (SIP),
      SIP and a mechanism by which user
      authentication and SIP registration authorization is delegated to a
      third party, using the OAuth 2.0 framework and OpenID Connect Core
      1.0. This kind of user authentication enables single sign-on,
      which allows the user to authenticate once and gain access to both SIP
      and non-SIP services.
      </t>
      <t>
      This document also updates <xref target="RFC3261"/>, target="RFC3261"/> by defining the UAC procedures
      when a UAC receives a 401/407 response with multiple WWW-Authenticate/Proxy-Authenticate
      header fields, providing challenges using different authentication schemes
      for the same realm.
      </t>
      <t>   </t>
      <section anchor="terminology">
        <name>Terminology</name>
        <t>
    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
          NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
          "MAY", "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
    "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>",
    "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "OPTIONAL" "<bcp14>OPTIONAL</bcp14>" in this document are
    to be interpreted as
    described in BCP 14 BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/>
    when, and only when, they appear in all capitals, as shown here.
        </t>
        <t>   </t>
      </section>
      <section anchor="section.this">
        <name>Applicability</name>
        <t>
        This document covers cases where grants that allow the UAC to obtain an
        access token from the AS are used. Cases where the UAC is not able to obtain
        an access token (e.g., in the case of an authorization code grant) are not covered.
        </t>
        <t>   </t>
      </section>
      <!-- Applicability -->

      <section anchor="tokens">
      <name>Token Types and Formats</name>

      <t>
      The tokens used in third-party authorization depend on the type of
      AS.
      </t>
      <t>
      An OAuth AS provides the following tokens to a successfully
      authorized UAC:
      </t>
      <ul
      <dl newline="true" spacing="normal">
      <li>
      Access token: the
      <dt>Access Token:</dt>
      <dd>The UAC will use this token to gain access to services by
      providing the token to a SIP server.
      </li>
      <li>
      Refresh token: the server.</dd>
      <dt>Refresh Token:</dt>
      <dd>The UAC will present this token to the AS
      to refresh a stale access token.
      </li>
      </ul>

      <t>
      An token.</dd>
      </dl>
      <t>An OP returns an additional token:
      </t>
      <ul token:</t>
      <dl newline="true" spacing="normal">
      <li>
      ID Token: this
      <dt>ID Token:</dt>
      <dd>This token contains a SIP URI associated with the user and other
      user-specific details that will be consumed by the UAC.
      </li>
      </ul>

      <t>
      Tokens UAC.</dd>
      </dl>
      <t>Tokens can be represented in two different formats:
      </t>
      <ul formats:</t>
      <dl newline="true" spacing="normal">
      <li>Structured Token: a
      <dt>Structured Token:</dt>
      <dd>A token that consists of a structured object that contains the
      claims associated with the token, e.g., JSON Web Token (JWT) (JWT), as defined
      in <xref target="RFC7519"/>.
      </li>
      <li>Reference Token: a target="RFC7519"/>.</dd>
      <dt>Reference Token:</dt>
      <dd>A token that consists of an opaque string that is used to obtain the
      details of the token and its associated claims, as defined in <xref target="RFC6749"/>.
      </li>
      </ul>
      target="RFC6749"/>.</dd>
      </dl>
      <t>
      Access Tokens tokens are represented in one of the above two formats. Refresh Tokens tokens
      usually are represented in a reference format, as this token is consumed
      only by the AS that
      issued the token.  The ID Token token is defined as a structured token in the form of a JWT.
      </t>
      <t></t>
      <t/>
      </section>
      <!-- Tokens -->

  <section anchor="sec.authnz.flow">
      <name>Example Flows</name>
      <section anchor="sec.reg.discovered.as">
        <name>Registration</name>
        <t>
        <xref target="fig-register-flow"/> below shows an example of a SIP registration, registration where
        the registrar informs the UAC about the AS from which the UAC can
        obtain an access token.
        </t>
        <figure anchor="fig-register-flow">
          <name>Example Registration Flow</name>
        <artwork><![CDATA[
<artwork name="" type="" align="left" alt=""><![CDATA[
  UAC                         Registrar                         AS/OP
---------------------------------------------------------------------
  |                               |                               |
  | [1] REGISTER                  |                               |
  |------------------------------>|                               |
  |                               |                               |
  | [2] 401 Unauthorized          |                               |
  |     WWW-Authenticate: Bearer "authz_server"="<authz_server>"  |
  |<------------------------------|                               |
  |                               |                               |
  | [3] The UAC interacts with the AS and obtains tokens, tokens using    |
  |     some out-of-scope mechanism.                              |
  |<=============================================================>|
  |                               |                               |
  | [4] REGISTER                  |                               |
  |     Authorization: Bearer <access_token>                      |
  |------------------------------>|                               |
  |                               | [5] HTTP POST /introspect     |
  |                               |     {access_token}            |
  |                               |       (OPTIONAL)              |
  |                               |------------------------------>|
  |                               |                               |
  |                               | [6] 200 OK {metadata}         |
  |                               |       (OPTIONAL)              |
  |                               |<------------------------------|
  |                               |                               |
  | [7] 200 OK                    |                               |
  |<------------------------------|                               |
  |                               |                               |
]]></artwork>
        </figure>
        <t>
        In step [1], the UAC starts the registration process by sending a
        SIP REGISTER request to the registrar without any credentials.
        </t>
        <t>
        In step [2], the registrar challenges the UA, UA by sending a SIP
        401 (Unauthorized) response to the REGISTER request. In the response,
        the registrar includes information about the AS to contact in order
        to obtain a token.
        </t>
        <t>
        In step [3], the UAC interacts with the AS via an out-of-scope mechanism, potentially using the OAuth Native
        App mechanism defined in <xref target="RFC8252"/>. The AS authenticates the user and provides the UAC with the
        tokens needed to access the SIP service.
        </t>
        <t>
        In step [4], the UAC retries the registration process by sending a new
        REGISTER request that includes the access token that the UAC
        obtained in the step above.
        </t>
        <t>
        The registrar validates the access token. If the access token is a
        reference token, the registrar MAY <bcp14>MAY</bcp14> perform an introspection
        <xref target="RFC7662"/>, as in steps [5] and [6], in order to obtain more
        information about the access token and its scope, per <xref target="RFC7662"/>.
        Otherwise, after the registrar validates the token, it inspects its
        claims and acts upon it.
        </t>
        <t>
        In step [7], once the registrar has successfully verified and accepted the
        access token, it sends a 200 (OK) response to the REGISTER request.
        </t>
        <t>   </t>
      </section>
      <!-- Registration-->

    <section anchor="sec.reg.preconfigured.as">
        <name>Registration with Preconfigured AS</name>
        <t>
        <xref target="fig-config-ua"/> shows an example of a SIP registration where
        the UAC has been preconfigured with information about the AS
        from which to obtain the access token.
        </t>
      <figure anchor="fig-config-ua">
        <name>Example Registration Flow - AS Information Preconfigured</name>
        <artwork><![CDATA[
<artwork name="" type="" align="left" alt=""><![CDATA[
  UAC                         Registrar                         AS/OP
---------------------------------------------------------------------
  |                               |                               |
  | [1] The UAC interacts with the AS and obtains tokens, tokens using    |
  |     some out of scope out-of-scope mechanism.                              |
  |<=============================================================>|
  |                               |                               |
  | [2] REGISTER                  |                               |
  |     Authorization: Bearer <access_token>                      |
  |------------------------------>|                               |
  |                               | [3] HTTP POST /introspect     |
  |                               |     {access_token}            |
  |                               |       (OPTIONAL)              |
  |                               |------------------------------>|
  |                               |                               |
  |                               | [4] 200 OK {metadata}         |
  |                               |       (OPTIONAL)              |
  |                               |<------------------------------|
  |                               |                               |
  | [5] 200 OK                    |                               |
  |<------------------------------|                               |
  |                               |                               |
]]></artwork>
      </figure>
        <t>
        In step [1], the UAC interacts with the AS using an out-of-scope mechanism, potentially using the OAuth Native
        App mechanism defined in <xref target="RFC8252"/>. The AS authenticates the user and provides the UAC with the
        tokens needed to access the SIP service.
        </t>
        <t>
        In step [2], the UAC initiates the registration process by sending a new
        REGISTER request that includes the access token that the UAC
        obtained in the step above.
        </t>
        <t>
        The registrar validates the access token. If the access token is a
        reference token, the registrar MAY <bcp14>MAY</bcp14> perform an introspection
        <xref target="RFC7662"/>, as in steps [4] and [5], in order to obtain more
        information about the access token and its scope, per <xref target="RFC7662"/>.
        Otherwise, after the registrar validates the token, it inspects its
        claims and acts upon it.
        </t>
        <t>
        In step [5], once the registrar has successfully verified and accepted the
        access token, it sends a 200 (OK) response to the REGISTER request.
        </t>
        <t>   </t>
      </section>
      <!-- Registration with Preconfigured AS-->
  </section>
    <!-- Example Flows-->
  </section>
    <!-- Introduction -->

  <section anchor="sec.sip">
      <name>SIP Procedures</name>
      <t>
      Section 22 of <xref target="RFC3261"/>
      <t><xref target="RFC3261" sectionFormat="of" section="22"/> defines the
      SIP procedures for the Digest authentication mechanism. The same
      procedures apply to the Bearer "Bearer" authentication mechanism, with the
      changes described in this section.
      </t> section.</t>
      <section anchor="sec.sip.uac">
        <name>UAC Behavior</name>
        <section anchor="sec.sip.uac.obtain">
          <name>Obtaining Tokens and Responding to Challenges</name>
          <t>
          When a UAC sends a request without credentials (or with invalid credentials),
          it could receive either a 401 (Unauthorized) response with a WWW-Authenticate header field or a 407 (Proxy
          Authentication Required) response with a Proxy-Authenticate header field.
          If the WWW-Authenticate or Proxy-Authenticate header field indicates "Bearer" scheme authentication
          and contains an address to an AS, the UAC contacts the
          AS in order to obtain tokens, tokens and includes the requested
          scopes, based on a local configuration (<xref target="fig-register-flow"/>).
          The UAC MUST <bcp14>MUST</bcp14> check the AS URL received in the 401/407 response
          against a list of trusted ASs configured on the UAC, UAC in order
          to prevent several classes of possible vulnerabilities when a client blindly
          attempts to use any provided AS.
          </t>
          <t>
          The detailed OAuth2 procedure to authenticate the user and obtain
          these tokens is out of scope of this document.
          The address of the AS might already be known to the UAC via configuration.
          In such cases, the UAC can contact the AS for tokens
          before it sends a SIP request (<xref target="fig-config-ua"/>).
          Procedures for native applications are defined in <xref target="RFC8252"/>.
          When using the mechanism defined
          in <xref target="RFC8252"/> target="RFC8252"/>, the user of the UAC will be directed to interact
          with the AS using a web browser, allowing which allows the AS
          to prompt the user for multi-factor authentication, to redirect the user to
          third-party identity providers, and to enable the use of single sign-on sessions.
          </t>
          <t>
          The tokens returned to the UAC depend on the type of AS: AS; an OAuth AS provides an
          access token and optionally and, optionally, a refresh token <xref target="RFC6749"/>. The refresh
          token is only used between the UAC and the AS. If the AS provides a refresh token
          to the UAC, the UAC uses it to request a new access token from
          the AS before the currently used access token expires (<xref target="RFC6749"/>, Section 1.5).
	  target="RFC6749" sectionFormat="comma" section="1.5"/>).
          If the AS does not provide a refresh token, the UAC needs to re-authenticate reauthenticate the user, user
          in order to get a new access token, token before the currently used access token expires.
          An OP returns an additional ID Token token that contains claims about
          the authentication of the user by an authorization server. The ID Token token can potentially
          include other optional claims about the user, e.g. e.g., the SIP URI, that will be consumed by
          the UAC and later used to register with the registrar.
          </t>
          <t>
          If the UAC receives a 401/407 response with multiple WWW-
          Authenticate/Proxy-Authenticate header fields, providing challenges
          using different authentication schemes for the same realm, the UAC
          provides credentials for one of the schemes that it supports,
          based on local policy.
          </t>
	  <aside>
          <t>
          NOTE: At the time of writing this document, writing, detailed
          procedures for the cases where a UAC receives multiple
          different authentication schemes had not been defined. A
          future specification might define such procedures.
          </t>
          <t>
          </t></aside>
          <aside><t>
          NOTE: The address of the AS might be known to the
          UAC
          UAC, e.g., using means of configuration, in which case the UAC can
          contact the AS in order to obtain the access token
          before it sends SIP request without credentials.
          </t>
          </t></aside>
        </section>
        <section anchor="sec.sip.uac.protect">
          <name>Protecting the Access Token</name>
          <t>
          <xref target="RFC6749"/> mandates that access tokens are protected with
          TLS when in transit. However, SIP makes use of intermediary SIP proxies,
          and TLS only guarantees hop-to-hop protection when used to protect SIP signaling.
          Therefore
          Therefore, the access token MUST <bcp14>MUST</bcp14> be protected in a way so that only authorized SIP
          servers will have access to it. SIP endpoints that support this document MUST <bcp14>MUST</bcp14>
          use encrypted JSON Web Tokens (JWT) JWTs <xref target="RFC7519"/> for encoding and protecting
          access tokens when they are included in SIP requests, unless some other mechanism
          is used to guarantee that only authorized SIP endpoints have access to
          the access token. TLS can still be used for protecting traffic between
          SIP endpoints and the AS, as defined in <xref target="RFC6749"/>.
          </t>
          <t>   </t>
        </section>
        <section anchor="sec.sip.uac.req.reg">
          <name>REGISTER Request</name>
          <t>
        The
          <t>The procedures in this section apply when the UAC has received a
	  challenge that contains a "Bearer" scheme, scheme and the UAC has obtained
	  a token token, as specified in <xref target="sec.sip.uac.obtain"/>.
          </t>
          <t>
        The target="sec.sip.uac.obtain"/>.</t>
          <t>The UAC sends a REGISTER request with an Authorization header
	  field containing the response to the challenge, including the Bearer "Bearer"
	  scheme carrying a valid access token in the request, as specified in
	  <xref target="RFC6750"/>.
          </t> target="RFC6750"/>.</t>
          <t>
        Note that, that if there were multiple challenges with different schemes, then the UAC may be
        able to successfully retry the request using non-Bearer non-"Bearer" credentials.
          </t>
          <t>
          Typically,
          <t>Typically, a UAC will obtain a new access token for each new binding,
	  binding. However, based on local policy, a UAC MAY <bcp14>MAY</bcp14>
	  include an access token that has been used for another binding
	  associated with the same Address Of Record (AOR) in the request.
          </t> request.</t>
          <t>
        If the access token included in a REGISTER request is not accepted, accepted
        and the UAC receives a 401 response or a 407 response, the UAC
        follows the procedures in <xref target="sec.sip.uac.obtain"/>.
          </t>
          <t>   </t>
        </section>
        <section anchor="sec.sip.uac.req.nonreg">
          <name>Non-REGISTER Request</name>
          <t>
        The
          <t>The procedures in this section apply when the UAC has received a
	  challenge that contains a "Bearer" scheme, scheme and the UAC has obtained a token
	  token, as specified in <xref target="sec.sip.uac.obtain"/>.
          </t> target="sec.sip.uac.obtain"/>.</t>
          <t>
          When the UAC sends a request, it MUST <bcp14>MUST</bcp14> include an Authorization header field
          with a Bearer scheme, "Bearer" scheme carrying a valid access token obtained from the AS indicated
          in the challenge, challenge in the request, as specified in <xref target="RFC6750"/>.
          Based on local policy, the UAC MAY <bcp14>MAY</bcp14> include an access token that has been used
          for another dialog, or for another stand-alone request, if the target of the
          new request is the same.
          </t>
          <t>
          If the access token included in a request is not accepted, accepted and the UAC receives
          a 401 response or a 407 response, the UAC follows the procedures in
          <xref target="sec.sip.uac.obtain"/>.
          </t>
          <t>   </t>
        </section>
      </section>
      <!-- UAC Behavior -->
    <section anchor="sec.sip.uas">
        <name>User Agent Server (UAS) and Registrar Behavior</name>
        <t>
        When a UAS or registrar receives a request that fails to contain
        authorization credentials acceptable to it, the UAS/registrar SHOULD <bcp14>SHOULD</bcp14> challenge the
        request by sending a 401 (Unauthorized) response. If the UAS/registrar
        chooses to challenge the request, request and is willing to accept an access token
        as a credential, it MUST <bcp14>MUST</bcp14> include a WWW-Authenticate header
        field in the response that indicates a "Bearer" scheme and includes an AS address,
        encoded as an https URI <xref target="RFC7230"/>, from which the UAC can obtain
        an access token.
        </t>
        <t>
        When a UAS or registrar receives a SIP request that contains an Authorization
        header field with an access token, the UAS/registrar MUST <bcp14>MUST</bcp14> validate the access
        token,
        token using the procedures associated with the type of access token (Structured (structured
        or Reference) reference) used, e.g., <xref target="RFC7519"/>.
        If the token provided is an expired access token, then the UAS/registrar MUST <bcp14>MUST</bcp14> reply with
        a 401 (Unauthorized) response, as defined in section 3 of <xref target="RFC6750"/>.
	target="RFC6750" sectionFormat="of" section="3"/>.
        If the validation is successful, the UAS/registrar can continue to process
        the request using normal SIP procedures. If the validation fails, the UAS/registrar
        MUST
        <bcp14>MUST</bcp14> reply with a 401 (Unauthorized) response.
        </t>
        <t>   </t>
      </section>
      <!-- UAS and Registrar Behavior -->
    <section anchor="sec.sip.proxy">
        <name>Proxy Behavior</name>
        <t>
        When a proxy receives a request that fails to contain
        authorization credentials acceptable to it, it SHOULD <bcp14>SHOULD</bcp14> challenge the
        request by sending a 407 (Proxy Authentication Required) response.
        If the proxy chooses to challenge the request, request and is willing to accept an access token
        as a credential, it MUST <bcp14>MUST</bcp14> include a Proxy-Authenticate
        header field in the response that indicates a "Bearer" scheme and includes an AS address,
        encoded as an https URI <xref target="RFC7230"/>, from which the UAC can obtain
        an access token.
        </t>
        <t>
        When a proxy wishes to authenticate a received request, it MUST <bcp14>MUST</bcp14>
        search the request for Proxy-Authorization header fields with 'realm'
        parameters that match its realm. It then MUST <bcp14>MUST</bcp14> successfully validate
        the credentials from at least one Proxy-Authorization header field
        for its realm. When the scheme is "Bearer", the proxy MUST <bcp14>MUST</bcp14> validate the
        access token, token using the procedures associated with the type of access
        token (Structured (structured or Reference) reference) used, e.g., <xref target="RFC7519"/>.
        </t>
        <t>   </t>
      </section>
      <!-- Proxy Behavior -->
  </section>
    <!-- SIP Procedures -->

  <section anchor="at.claims">
      <name>Access Token Claims</name>
      <t>
    The type of services to which an access token grants access can be determined
    using different methods. The methods used and the access provided by the token
    are based on local policy agreed between the AS and the registrar.
      </t>
      <t>
    If an access token is encoded as a JWT, it will contain a list of claims
    <xref target="RFC7519"/>, including both registered and application-specific claims. The
    registrar can grant access to services based on such claims,
    some other mechanism, or a combination of claims and some other mechanism.
    If an access token is a reference token, the registrar will grant access
    based on some other mechanism. Examples of such other mechanisms are
    introspection <xref target="RFC7662"/> and user profile lookups.
      </t>
      <t>   </t>
    </section>
    <section anchor="www-authenticate.response.header">
      <name>WWW-Authenticate Response Header Field</name>
      <t>
      This
      <t>This section uses ABNF <xref target="RFC5234"/> to describe the
      syntax of the WWW-Authenticate header  field when used with the "Bearer"
      scheme to challenge the UAC for credentials, credentials by extending the
      'challenge' parameter defined by <xref target="RFC3261"/>.
      </t>
      <figure>
        <name>Bearer target="RFC3261"/>.</t>
<figure anchor="bearer-syntax">
<name>"Bearer" Scheme Syntax</name>

<sourcecode type="abnf"><![CDATA[ type="abnf">
challenge  =/  ("Bearer" LWS bearer-cln *(COMMA bearer-cln))
bearer-cln = realm / scope-param / authz-server-param / error-param /
             auth-param
realm = <defined &lt;defined in RFC3261> RFC 3261&gt;
scope-param = "scope" EQUAL DQUOTE scope DQUTE DQUOTE
scope = <defined &lt;defined in RFC6749> RFC 6749&gt;
authz-server-param = "authz_server" EQUAL DQUOTE authz-server DQUOTE
authz-server = https-URI
https-URI = <defined &lt;defined in RFC7230> RFC 7230&gt;
error-param = "error" EQUAL DQUOTE error DQUOTE
error = <defined &lt;defined in RFC6749> RFC 6749&gt;
auth-param = <defined &lt;defined in RFC3261>
  ]]></sourcecode> RFC 3261&gt;
  </sourcecode>
        </figure>
      <t>
  The authz_server parameter contains the HTTPS URI, as defined in
  <xref target="RFC7230"/>, of the AS. The UAC can discover
  metadata about the AS using a mechanism like the one defined in <xref target="RFC8414"/>.
      </t>
      <t>
  The realm and auth-param parameters are defined in <xref target="RFC3261"/>.
      </t>
      <t>
  Per <xref target="RFC3261"/>, the "the realm string alone defines the protection
  domain.
  domain". <xref target="RFC3261"/> states that the realm string must be
  globally unique and recommends that the realm string contain a hostname or
  domain name. It also states that the realm string should be a human-readable identifier
  that can be rendered to the user.
      </t>
      <t>
  The scope and error parameters are defined in <xref target="RFC6749"/>.
      </t>
      <t>
  The scope parameter can be used by the registrar/proxy to indicate to the UAC
  the minimum scope that must be associated with the access token to be able to get
  service. As defined in <xref target="RFC6749"/>, the value of the scope parameter
  is expressed as a list of space-delimited, case-sensitive strings. The strings are
  defined by the AS. The values of the scope parameter are out of
  scope of this document. The UAC will use the scope provided by the registrar to
  contact the AS and obtain a proper token with the requested scope.
      </t>
      <t>
  The error parameter could be used by the registrar/proxy to indicate to the UAC
  the reason for the error, with possible values of "invalid_token" or "invalid_scope".
      </t>
      <t>   </t>
    </section>
    <!-- WWW-Authenticate Response Header Field -->

  <section anchor="security.considerations">
      <name>Security Considerations</name>
      <t>
      The security considerations for OAuth are defined in <xref target="RFC6749"/>.
      The security considerations for bearer "Bearer" tokens are defined in <xref target="RFC6750"/>.
      The security considerations for  JSON Web Tokens (JWT) JWTs are defined in <xref target="RFC7519"/>.
      These security considerations also apply to SIP usage of access token tokens, as defined in this
      document.
      </t>
      <t>
      <xref target="RFC6749"/> mandates that access tokens are protected with
      TLS when in transit. However, SIP makes have use of intermediary SIP proxies,
      and TLS only guarantees hop-to-hop protection when used to protect SIP signaling.
      Therefore
      Therefore, the access token MUST <bcp14>MUST</bcp14> be protected in a way so that only authorized SIP
      servers will have access to it. SIP endpoints that support this document MUST <bcp14>MUST</bcp14>
      use encrypted JSON Web Tokens (JWT) JWTs <xref target="RFC7519"/> for encoding and protecting
      access tokens when they are included in SIP requests, unless some other mechanism
      is used to guarantee that only authorized SIP endpoints have access to
      the access token. TLS can still be used for protecting traffic between
      SIP endpoints and the AS, as defined in <xref target="RFC6749"/>.
      </t>
      <t>
      Single Sign-On (SSO) enables the user to use one set of credentials to
      authenticate once and gain access to multiple SIP and non-SIP services
      using access token(s). If the SSO login is compromised, that single
      point of compromise has a much broader effect than is the case without
      SSO. Further, an attacker can often use a compromised account to set
      up Single Sign-On for other services that the victim has not
      established an account with, with and sometimes can even switch a dedicated
      account into Single-Sign-On SSO mode, creating a still broader attack.
      </t>
      <t>
      Because of that, it is critical to make sure that extra security
      measures be taken to safeguard credentials used for Single Sign-On.
      Examples of such measures include a long passphrase instead of a
      password, enabling multi-factor factor authentication, and the use of
      the native platform browser when possible, as defined in <xref target="RFC8252"/>.
      </t>
      <t>
      Although this is out of scope for this document, it is important to
      carefully consider the claims provided in the tokens used to access
      these services to make sure of the privacy of the user accessing these
      services. As mentioned above, this document calls for encrypting JWT JWTs
      representing the access token.
      </t>
      <t>
      It is important that both parties participating in SSO provide
      mechanisms for users to sever the SSO relationship, relationship so that it is
      possible without undue difficulty to mitigate a compromise that has
      already happened.
      </t>
      <t>
      The operator of a Single-Sign-On an SSO authentication system has access to
      private information about sites and services that their users log
      into,
      into and even, to some extent, about their usage patterns.  It's
      important to call these out in privacy disclosures and policies, policies and
      to make sure that users can be aware of the tradeoffs trade-offs between
      convenience and privacy when they choose to use SSO.
      </t>
      <t>
      When a registrar chooses to challenge a REGISTER request, if the registrar
      can provide access to different levels of services, it is RECOMMENDED <bcp14>RECOMMENDED</bcp14> that
      the registrar includes include a scope in the response in order to indicate the minimum
      scope needed to register and access basic services. The access token might
      include an extended scope that gives the user access to more advanced features
      beyond basic services. In SIP, the AS administrator will typically decide what level
      of access is provided for a given user.
      </t>
      <t>
      The UAC MUST <bcp14>MUST</bcp14> check the AS URL received in the 401/407 response
      against a list of trusted ASs configured on the UAC, UAC in order
      to prevent several classes of possible vulnerabilities when a client blindly
      attempts to use any provided AS.
      </t>
      <t>   </t>
    </section>
    <!-- Security Considerations -->

  <section anchor="iana.considerations">
      <name>IANA Considerations</name>

      <section anchor="iana.considerations.proxy-authenticate.param">
        <name>New Proxy-Authenticate header field parameters</name> Header Field Parameters</name>
        <t>
        This section defines new SIP header field parameters in the "Header Field
        Parameters and Parameter Values" subregistry of the "Session
        Initiation Protocol (SIP) Parameters" registry: https://www.iana.org/assignments/sip-parameters
        </t>

        <figure align="center"><artwork>
        <![CDATA[
  Header <eref
	target="https://www.iana.org/assignments/sip-parameters" brackets="angle"/>
        </t>
<table anchor="proxy-authenticate" align="center">
  <name>Header Field:  Proxy-Authenticate

  Parameter Name:  authz_server
  Predefined Values:  No
  Reference:  RFC XXXX

  Parameter Name:  error
  Predefined Values:  No
  Reference:  RFC XXXX

  Parameter Name:  scope
  Predefined Values:  No
  Reference:  RFC XXXX
]]></artwork></figure> Proxy-Authenticate</name>
  <thead>
    <tr>
      <th>Parameter Name</th>
      <th>Predefined Values</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>authz_server</td>
      <td>No</td>
      <td>RFC 8898</td>
    </tr>
    <tr>
      <td>error</td>
      <td>No</td>
      <td>RFC 8898</td>
    </tr>
    <tr>
      <td>scope</td>
      <td>No</td>
      <td>RFC 8898</td>
    </tr>
  </tbody>
</table>
    </section>
    <section anchor="iana.considerations.www-authenticate.param">
        <name>New WWW-Authenticate header field parameters</name> Header Field Parameters</name>
        <t>
        This section defines new SIP header field parameters in the "Header Field
        Parameters and Parameter Values" subregistry of the "Session
        Initiation Protocol (SIP) Parameters" registry: https://www.iana.org/assignments/sip-parameters
        </t>

        <figure align="center"><artwork>
        <![CDATA[
  Header <eref
	target="https://www.iana.org/assignments/sip-parameters" brackets="angle"/>
        </t>
<table anchor="www-authenticate" align="center">
  <name>Header Field:  WWW-Authenticate

  Parameter Name:  authz_server
  Predefined Values:  No
  Reference:  RFC XXXX

  Parameter Name:  error
  Predefined Values:  No
  Reference:  RFC XXXX

  Parameter Name:  scope
  Predefined Values:  No
  Reference:  RFC XXXX
]]></artwork></figure> WWW-Authenticate</name>
  <thead>
    <tr>
      <th>Parameter Name</th>
      <th>Predefined Values</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>authz_server</td>
      <td>No</td>
      <td>RFC 8898</td>
    </tr>
    <tr>
      <td>error</td>
      <td>No</td>
      <td>RFC 8898</td>
    </tr>
    <tr>
      <td>scope</td>
      <td>No</td>
      <td>RFC 8898</td>
    </tr>
  </tbody>
</table>
    </section>
  </section>
  <!-- IANA Considerations -->

    <!-- Acknowledgments -->

</middle>
  <!-- ********************************** BACK ********************************** -->
<back>
    <references>
      <name>Normative References</name>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3261.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6749.xml"/>

      <reference anchor="OPENID">
        <front>
          <title abbrev="OpenID">OpenID Connect Core 1.0</title>
          <author initials="N." surname="Sakimura" fullname="Nat Sakimura"/>
          <author initials="J." surname="Bradley" fullname="John Bradley"/>
          <author initials="M." surname="Jones" fullname="Michael Jones"/>
          <author initials="B." surname="de Medeiros" fullname="Breno de Medeiros"/>
          <author initials="C." surname="Mortimore" fullname="Chuck Mortimore"/>
          <date month="February" year="2014"/>
        </front>
      </reference>

      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7662.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6750.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7230.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
    </references>
        <references>
      <name>Informative References</name>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8252.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8414.xml"/>
    </references>
  <section anchor="acknowledgments"> anchor="acknowledgments" numbered="false">
      <name>Acknowledgments</name>
      <t>
      The
      <t>The authors would like to specially thank Paul Kyzivat <contact fullname="Paul
      Kyzivat"/> for his multiple detailed reviews and suggested text that
      significantly improved the quality of the document.
      </t>
      <t>
      The document.</t>
      <t>The authors would also like to thank the following for their review
      and feedback on this document:
      </t>
      <t>
      Olle Johansson, Roman Shpount, Dale Worley, and Jorgen Axell.
      </t>
      <t>
      The document:</t>
      <t><contact fullname="Olle Johansson"/>, <contact fullname="Roman
      Shpount"/>, <contact fullname="Dale Worley"/>, and <contact
      fullname="Jorgen Axell"/>.</t>
      <t>The authors would also like to thank the following for their review
      and feedback of the original document that was replaced with this document:
      </t>
      <t>
      Andrew Allen, Martin Dolly, Keith Drage, Paul Kyzivat, Jon Peterson,
      Michael Procter, Roy Radhika, Matt Ryan, Ivo Sedlacek, Roman Shpount,
      Robert Sparks, Asveren Tolga, Dale Worley, and Yehoshua Gev.
      </t>
      <t>
      Roman Danyliw, Benjamin Kaduk, Erik Kline, Barry Leiba, Eric Vyncke and
      Magnus Westerlund
      document:</t>
      <t><contact fullname="Andrew Allen"/>, <contact fullname="Martin
      Dolly"/>, <contact fullname="Keith Drage"/>, <contact fullname="Paul
      Kyzivat"/>, <contact fullname="Jon Peterson"/>, <contact
      fullname="Michael Procter"/>, <contact fullname="Roy Radhika"/>,
      <contact fullname="Matt Ryan"/>, <contact fullname="Ivo Sedlacek"/>,
      <contact fullname="Roman Shpount"/>, <contact fullname="Robert
      Sparks"/>, <contact fullname="Asveren Tolga"/>, <contact fullname="Dale
      Worley"/>, and <contact fullname="Yehoshua Gev"/>.</t>
      <t><contact fullname="Roman Danyliw"/>, <contact fullname="Benjamin
      Kaduk"/>, <contact fullname="Erik Kline"/>, <contact fullname="Barry
      Leiba"/>, <contact fullname="Eric Vyncke"/>, and <contact
      fullname="Magnus Westerlund"/>  provided feedback and suggestions for
      improvements as part of the IESG evaluation of the document. Special
      thanks to Benjamin
      Kaduk <contact fullname="Benjamin Kaduk"/> for his detailed and
      comprehensive reviews and comments.
      </t>
      <t>
      The comments.</t>
      <t>The authors would also like to specially thank Jean Mahoney <contact
      fullname="Jean Mahoney"/> for her multiple reviews, editorial help, and
      the coversion conversion of the XML source file from v2 to v3.
      </t>
      <t></t>
      <t></t>
      <t></t>
      <t></t> v3.</t>
  </section>
    <!-- Acknowledgments -->

</middle>
  <!-- ********************************** BACK ********************************** -->
<back>
    <references>
      <name>Normative References</name>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3261.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6749.xml"/>

<!-- [rfced] [OPENID] URL https://openid.net/specs/openid-connect-core-1_0-final.html  -->

      <reference anchor="OPENID">
        <front>
          <title abbrev="OpenID">OpenID Connect Core 1.0</title>
          <author initials="N." surname="Sakimura" fullname="Nat Sakimura"/>
          <author initials="J." surname="Bradley" fullname="John Bradley"/>
          <author initials="M." surname="Jones" fullname="Michael Jones"/>
          <author initials="B." surname="de Medeiros" fullname="Breno de Medeiros"/>
          <author initials="C." surname="Mortimore" fullname="Chuck Mortimore"/>
          <date month="February" year="2014"/>
        </front>
      </reference>

      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7662.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6750.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7230.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
    </references>
        <references>
      <name>Informative References</name>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8252.xml"/>
      <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8414.xml"/>
    </references>

  </back>
</rfc>