<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3"
  docName="draft-bunch-groupware-scopes-01" ipr="trust200902" submissionType="IETF"
  consensus="false" category="exp">

  <front>
    <title abbrev="OAuth Groupware Auth">A Rich Authorization Request Framework for Groupware
      Services using OAuth 2.0</title>
    <author fullname="Clinton Bunch" initials="C" surname="Bunch">
      <organization>Emerald Groupware Project</organization>
      <address>
        <email>cdbunch@emeraldgroupware.org</email>
      </address>
    </author>
    <date year="2025" month="July" day="20" />
    <area>Security</area>
    <keyword>OAuth</keyword>
    <keyword>scope</keyword>
    <keyword>RAR</keyword>
    <keyword>mail</keyword>
    <keyword>calendar</keyword>
    <keyword>contacts</keyword>
    <keyword>JMAP</keyword>

    <abstract>
      <t>
        The OAuth 2.0 authorization framework is widely used to provide clients with delegated
        access to user data. However, the core specification leaves the definition of access scopes
        to individual service providers. This has led to a fragmented ecosystem for common groupware
        services (Mail, Calendaring, Contacts), where each provider uses proprietary,
        non-interoperable scope identifiers. Client applications, such as desktop mail clients, are
        forced to hardcode configurations for a small number of large providers, stifling innovation
        and harming open ecosystems.
      </t>
      <t>
        This document proposes a framework that combines a minimal set of standardized OAuth 2.0
        scopes with a detailed structure for use with OAuth 2.0 Rich Authorization Requests (RAR).
        This hybrid approach provides a simple baseline for legacy clients while enabling powerful,
        granular, and privacy-preserving authorization for modern clients. It defines RAR <tt>type</tt>
        values, <tt>actions</tt>, <tt>datatypes</tt>, and custom fields for specifying fine-grained permissions
        for groupware resources.
      </t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t> While OAuth 2.0 <xref target="RFC6749" /> is ubiquitous, its reliance on provider-defined
        scopes has created a fragmented ecosystem for groupware. A client application cannot
        automatically configure itself for a new mail or calendar provider, as it has no standard
        way to request specific permissions like "read-only access to the 'Work' calendar." </t>
      <t> This document specifies a solution that leverages the recent OAuth 2.0 Rich Authorization
        Requests (RAR) <xref target="RFC9396" /> standard to define structured, granular
        permissions. To maintain backward compatibility and provide a simple path for basic clients,
        this detailed RAR structure is paired with a minimal set of three high-level scopes. </t>
      <t>
        This allows a client to request simple access (e.g., <tt>scope=mail</tt>) or to make a much more
        specific request, such as asking for permission to read and delete messages only from the
        "INBOX" folder and send email as a specific alias. This improves both security and user
        privacy by adhering to the principle of least privilege.
      </t>
      <section anchor="reqs" title="Requirements Language">
        <t> The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD
          NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119" /> <xref target="RFC8174" />
          when, and only when, they appear in all capitals, as shown here. </t>
      </section>
    </section>

    <section anchor="scopes" title="Groupware Scopes">
      <t>
        This specification proposes three aggregate scope values to represent high-level access to a
        user's groupware data. These scopes are intended as a baseline for simple clients or as a
        companion to more detailed Rich Authorization Requests.
      </t>
      <dl newline="true">
        <dt>urn:ietf:params:oauth:scope:mail</dt>
        <dd>Requests access to the user's email. The specific level of access <bcp14>SHOULD</bcp14>
          be further specified using a Rich Authorization Request of type
          <tt>urn:ietf:params:oauth:auth-type:mail</tt>. If RAR is not used, this scope implies full
          access.</dd>
        <dt>urn:ietf:params:oauth:scope:calendar</dt>
        <dd>Requests access to the user's calendar data. Granular permissions <bcp14>SHOULD</bcp14>
          be requested via a Rich Authorization Request of type
          <tt>urn:ietf:params:oauth:auth-type:calendar</tt>.</dd>
        <dt>urn:ietf:params:oauth:scope:contacts</dt>
        <dd>Requests access to the user's contact data. Granular permissions <bcp14>SHOULD</bcp14>
          be requested via a Rich Authorization Request of type
          <tt>urn:ietf:params:oauth:auth-type:contacts</tt>.</dd>
      </dl>
    </section>

    <section anchor="rar" title="Rich Authorization Request Types for Groupware">
      <t>
        This document defines a set of <tt>type</tt> values and associated fields for use within the
        <tt>authorization_details</tt> array of an OAuth 2.0 Rich Authorization Request.
      </t>

      <section anchor="rar-custom-fields" title="Custom Authorization Details Fields">
        <t>This specification defines the following new fields for use within the
          <tt>authorization_details</tt> object to provide granular control over groupware resources.</t>
        <dl newline="true">
          <dt><tt>collections</tt> (array of strings):</dt>
          <dd>This field specifies the names or unique identifiers of the collections (e.g., mail
            folders, calendars) to which the request is scoped. The special value <tt>"*"</tt>
            indicates all collections of the specified datatypes. To solve the initial client
            bootstrapping problem, the special string value <tt>"__default" (two underscores)</tt>
            may be used. If provided, the Authorization Server <bcp14>SHOULD</bcp14> grant access to
            the user's primary or default collection for the given <tt>type</tt> (e.g., the INBOX
            for mail, the default calendar for CalDAV). If this field is omitted entirely, access <bcp14>
            SHOULD</bcp14> be treated as if no collections were granted. To prevent ambiguity,
            Resource Servers <bcp14>SHOULD NOT</bcp14> allow users to create collections with names
            that begin with two underscores.</dd>
          <dt><tt>type_specific_details</tt> (object):</dt>
          <dd>This object contains parameters that are unique to a specific authorization <tt>type</tt>
            and do not fit into the other standard fields.</dd>
        </dl>
      </section>

      <section anchor="rar-mail" title="The 'mail' Authorization Type">
        <t>This type is used to request granular access to a user's email.</t>
        <dl newline="true">
          <dt>type:</dt>
          <dd>
            <tt>urn:ietf:params:oauth:auth-type:mail</tt>
          </dd>
          <dt>Associated Scope:</dt>
          <dd>
            <tt>urn:ietf:params:oauth:scope:mail</tt>
          </dd>
          <dt>Defined <tt>datatypes</tt>:</dt>
          <dd><tt>folder</tt>, <tt>message</tt>, <tt>flag</tt></dd>
          <dt>Defined <tt>actions</tt>:</dt>
          <dd><tt>list</tt>, <tt>create</tt>, <tt>read</tt>, <tt>update</tt>, <tt>delete</tt></dd>
          <dt>Contents of <tt>type_specific_details</tt>:</dt>
          <dd>
            <dl newline="true">
              <dt><tt>send_as_aliases</tt> (array of strings):</dt>
              <dd>Specifies the email addresses the client is permitted to use in the <tt>From:</tt> header
                when performing a <tt>send</tt> action. The value <tt>"*"</tt> indicates any of the user's
                available sending addresses.</dd>
            </dl>
          </dd>
        </dl>
      </section>

      <section anchor="rar-calendar" title="The 'calendar' Authorization Type">
        <t>This type is used to request granular access to a user's calendars.</t>
        <dl newline="true">
          <dt>type:</dt>
          <dd>
            <tt>urn:ietf:params:oauth:auth-type:calendar</tt>
          </dd>
          <dt>Associated Scope:</dt>
          <dd>
            <tt>urn:ietf:params:oauth:scope:calendar</tt>
          </dd>
          <dt>Defined <tt>datatypes</tt>:</dt>
          <dd><tt>calendar</tt>, <tt>event</tt>, <tt>freebusy</tt></dd>
          <dt>Defined <tt>actions</tt>:</dt>
          <dd><tt>list</tt>, <tt>create</tt>, <tt>read</tt>, <tt>update</tt>, <tt>delete</tt></dd>
        </dl>
      </section>

      <section anchor="rar-contacts" title="The 'contacts' Authorization Type">
        <t>This type is used to request granular access to a user's address books.</t>
        <dl newline="true">
          <dt>type:</dt>
          <dd>
            <tt>urn:ietf:params:oauth:auth-type:contacts</tt>
          </dd>
          <dt>Associated Scope:</dt>
          <dd>
            <tt>urn:ietf:params:oauth:scope:contacts</tt>
          </dd>
          <dt>Defined <tt>datatypes</tt>:</dt>
          <dd><tt>addressbook</tt>, <tt>contact</tt></dd>
          <dt>Defined <tt>actions</tt>:</dt>
          <dd><tt>list</tt>, <tt>create</tt>, <tt>read</tt>, <tt>update</tt>, <tt>delete</tt></dd>
        </dl>
      </section>
    </section>

    <section anchor="security" title="Security Considerations">
      <t> The principle of least privilege <bcp14>SHOULD</bcp14> be followed. A client application <bcp14>
        SHOULD</bcp14> use Rich Authorization Requests to request the narrowest set of permissions
        required for their functionality. For example, a scheduling assistant application that only
        needs to find open time slots should request only the <tt>freebusy</tt> datatype and the <tt>list</tt> and
        <tt>read</tt> actions for the <tt>calendar</tt> type, limited to specific calendars if possible. </t>
      <t> Authorization servers <bcp14>MUST</bcp14> ensure that a user has explicitly consented to
        the scopes and rich authorization details requested by a client. Resource Servers are
        responsible for parsing the access token and correctly enforcing the authorized permissions. </t>
    </section>

    <section anchor="iana" title="IANA Considerations">
      <t>This document requests the registration of new values in several IANA-managed registries.</t>

      <section anchor="iana-scopes" title="OAuth Scope Registry">
        <t>This document requests registration of the following three values in the "OAuth Scope
          Registry".</t>
        <section title="urn:ietf:params:oauth:scope:mail">
          <dl newline="true">
            <dt>Name:</dt>
            <dd>urn:ietf:params:oauth:scope:mail</dd>
            <dt>Description:</dt>
            <dd>Requests access to a user's email.</dd>
            <dt>Change Controller:</dt>
            <dd>IETF</dd>
            <dt>Reference:</dt>
            <dd>This document.</dd>
          </dl>
        </section>
        <section title="urn:ietf:params:oauth:scope:calendar">
          <dl newline="true">
            <dt>Name:</dt>
            <dd>urn:ietf:params:oauth:scope:calendar</dd>
            <dt>Description:</dt>
            <dd>Requests access to a user's calendar data.</dd>
            <dt>Change Controller:</dt>
            <dd>IETF</dd>
            <dt>Reference:</dt>
            <dd>This document.</dd>
          </dl>
        </section>
        <section title="urn:ietf:params:oauth:scope:contacts">
          <dl newline="true">
            <dt>Name:</dt>
            <dd>urn:ietf:params:oauth:scope:contacts</dd>
            <dt>Description:</dt>
            <dd>Requests access to a user's contact data.</dd>
            <dt>Change Controller:</dt>
            <dd>IETF</dd>
            <dt>Reference:</dt>
            <dd>This document.</dd>
          </dl>
        </section>
      </section>

      <section anchor="iana-rar-types" title="OAuth Authorization Details Types Registry">
        <t>This document requests registration of the following three values in the "OAuth
          Authorization Details Types Registry".</t>
        <section title="urn:ietf:params:oauth:auth-type:mail">
          <dl newline="true">
            <dt>Name:</dt>
            <dd>urn:ietf:params:oauth:auth-type:mail</dd>
            <dt>Description:</dt>
            <dd>Authorization details for accessing email resources.</dd>
            <dt>Change Controller:</dt>
            <dd>IETF</dd>
            <dt>Reference:</dt>
            <dd>This document.</dd>
          </dl>
        </section>
        <section title="urn:ietf:params:oauth:auth-type:calendar">
          <dl newline="true">
            <dt>Name:</dt>
            <dd>urn:ietf:params:oauth:auth-type:calendar</dd>
            <dt>Description:</dt>
            <dd>Authorization details for accessing calendar resources.</dd>
            <dt>Change Controller:</dt>
            <dd>IETF</dd>
            <dt>Reference:</dt>
            <dd>This document.</dd>
          </dl>
        </section>
        <section title="urn:ietf:params:oauth:auth-type:contacts">
          <dl newline="true">
            <dt>Name:</dt>
            <dd>urn:ietf:params:oauth:auth-type:contacts</dd>
            <dt>Description:</dt>
            <dd>Authorization details for accessing contact resources.</dd>
            <dt>Change Controller:</dt>
            <dd>IETF</dd>
            <dt>Reference:</dt>
            <dd>This document.</dd>
          </dl>
        </section>
      </section>
    </section>
  </middle>


  <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.6749.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.9396.xml" />
    </references>

    <section anchor="appendix-schemas" title="JSON Schema for Authorization Details">
      <t>This appendix provides non-normative JSON Schema definitions for the
        <tt>authorization_details</tt> objects defined in this document.</t>
      <section title="Mail Authorization Details Schema">
        <sourcecode type="json">
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Mail Authorization Details",
  "type": "object",
  "properties": {
    "type": {
      "const": "urn:ietf:params:oauth:auth-type:mail"
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      }
    },
    "actions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "list",
          "create",
          "read",
          "update",
          "delete"
        ]
      }
    },
    "datatypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "folder",
          "message",
          "flag"
        ]
      }
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "type_specific_details": {
      "type": "object",
      "properties": {
        "send_as_aliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "required": [
    "type",
    "actions",
    "datatypes"
  ]
}</sourcecode>
      </section>
      <section title="Calendar Authorization Details Schema">
        <sourcecode type="json">
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Calendar Authorization Details",
  "type": "object",
  "properties": {
    "type": {
      "const": "urn:ietf:params:oauth:auth-type:calendar"
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      }
    },
    "actions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "list",
          "create",
          "read",
          "update",
          "delete"
        ]
      }
    },
    "datatypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "calendar",
          "event",
          "freebusy"
        ]
      }
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "type",
    "actions",
    "datatypes"
  ]
}</sourcecode>
      </section>
      <section title="Contacts Authorization Details Schema">
        <sourcecode type="json">
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Contacts Authorization Details",
  "type": "object",
  "properties": {
    "type": {
      "const": "urn:ietf:params:oauth:auth-type:contacts"
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      }
    },
    "actions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "list",
          "create",
          "read",
          "update",
          "delete"
        ]
      }
    },
    "datatypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "addressbook",
          "contact"
        ]
      }
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "type",
    "actions",
    "datatypes"
  ]
}</sourcecode>
      </section>
    </section>
    <section anchor="changes" title="Changes from Version -00">
      <t> This version represents a significant revision based on initial community feedback. The
        core focus has shifted from defining a large set of granular scopes to a more flexible and
        modern framework that combines a minimal set of aggregate scopes with the structured data
        model of OAuth 2.0 Rich Authorization Requests (RAR) <xref target="RFC9396" />. </t>
      <t>Major changes include:</t>
      <ul>
        <li>
          The document title has been updated to reflect the new focus on Rich Authorization
          Requests.
        </li>
        <li> The number of proposed scopes has been reduced to three primary aggregate scopes (<tt>
          mail</tt>, <tt>calendar</tt>, <tt>contacts</tt>) to provide a simple baseline for all
          clients. </li>
        <li> A new major section has been added defining RAR <tt>type</tt> values, <tt>actions</tt>, <tt>
          datatypes</tt>, and custom fields (<tt>collections</tt>, <tt>type_specific_details</tt>)
          that allow for fine-grained permission requests. </li>
        <li> The specification is now more closely aligned with the structure and intent of RFC
          9396, including the use of URIs in the <tt>locations</tt> field. </li>
        <li> An appendix has been added with non-normative JSON Schema definitions for the proposed <tt>
          authorization_details</tt> objects. </li>
      </ul>
    </section>
  </back>
</rfc>
