<?xml version="1.0" encoding="us-ascii"?>
<?xml-stylesheet type='text/xsl' href='http://xml2rfc.tools.ietf.org/authoring/rfc2629.xslt' ?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="4"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc category="std" docName="draft-cecchetti-oauth-rar-cedar-01" ipr="trust200902">
	<front>
		<title abbrev="OAuth Access Token JWT Profile">Cedar Profile for OAuth 2.0 Rich Authorization Requests</title>

		<author fullname="Sarah Cecchetti" initials="S." surname="Cecchetti">
			<organization>Amazon</organization>
			<address><email>sarahcec@amazon.com</email></address>
		</author>

		<date />

		<area>Security</area>
		<workgroup>OAuth Working Group</workgroup>

		<keyword>OAuth</keyword>
		
		<abstract>
			<t>
        This specification defines a profile of OAuth 2.0 Rich Authorization Requests in Cedar policy format within the authorization_details JSON object. Authorization servers
		and resource servers from different vendors can leverage this profile to distribute and recieve relevant Cedar policy sets in an interoperable manner.  
</t>
		</abstract>

	</front>

	<middle>
		<section anchor="Introduction" title="Introduction">
			<t>
  The original Auth 2.0 Rich Authorization Requests specification does not mandate any specific format for an authorization_detail parameter. 
  This specification aims to provide a standardized and interoperable profile as an alternative to proprietary authorization_detail formats.
			</t>
			<t>
				The purpose of a Cedar policy response format is to enable an authorization server to provide a client with a set of permissions in the format of Cedar policies which enable the client and the resource server to have a shared understanding, signed by the authorization server, of what actions are permissable in what contexts. 
			</t>
<t>
		For example, an authorization request for a credit transfer (designated as "payment initiation" in several open banking initiatives) can be represented using a Cedar policy within a JSON object with double quote marks escaped like this:
			</t>
<figure align="left" suppress-title="false" pn="figure-1">
        <name slugifiedName="name-example-of-an-authorization">Example of a Cedar Authorization Request for a Credit Transfer
</name>
        <sourcecode>

{
"type": "payment_initiation"
"rarFormat": "cedar",
"policySet": "
  permit (
  	principal == BankA::User::\"696d28c8-8912-41d2-b182-aa7087323318\",
   	action == BankA::Action::\"initiate\",
    resource == Creditor::\"https://example.com/payments\"
	)
	when { context.instructedAmount.currency == \"EUR\" &amp;&amp;
    context.instructedAmount.amount == decimal(\"123.50\") &amp;&amp;
    resource.creditorName == \"Merchant A\" &amp;&amp;
    resource.creditorAccount.bic == \"ABCIDEFFXXX\" &amp;&amp;
    resource.creditorAccount.iban == \"DE02100100109307118603\" &amp;&amp;
    context.remittanceInformationUnstructured == \"Ref Number Merchant\"
	};
"
}
</sourcecode>
      </figure>
			<t>
  Finally, this specification provides security and privacy considerations meant to prevent common mistakes and anti patterns 
that are likely to occur.
			</t>
			<section anchor="RNC" title="Requirements Notation and Conventions">
				<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 
  when, and only when, they appear in all capitals, as shown here.
				</t>
			</section>

			<section anchor="Terminology" title="Terminology">
	
				<t>
        This specification uses the terms
        "access token",
        "refresh token",
        "authorization server",
        "resource server",
        "authorization endpoint",
        "authorization request",
        "authorization response",
        "token endpoint",
        "grant type",
        "access token request",
        "access token response",
        and "client"
        defined by The OAuth 2.0 Authorization Framework.
				</t>
			</section>

		</section>

		<section anchor="CedarRequestFormat" title="Request in Cedar Policy Format">
			<t>
			The authorization_details parameter in a Rich Authorization Request token request MAY contain the field "rarFormat" and in order to be compliant with this profile that field MUST equal the value "cedar".
			</t>
			<t>An <tt>authorization_details</tt> array <bcp14>MAY</bcp14> contain multiple entries of the same <tt>type</tt>.</t>
      <t ><xref target="figure2" format="default" sectionFormat="of" derivedContent="Figure 2"/> shows an <tt>authorization_details</tt> of type <tt>payment_initiation</tt> using the example data shown above:</t>

			<figure anchor="figure2" align="left" suppress-title="false" pn="figure-2">
        <name slugifiedName="name-example-of-authorization_de">Example of "authorization_details" for a Credit Transfer
</name>
              <sourcecode type="json" markers="false">
[
	{
   	"type": "payment_initiation"
   	"rarFormat": "cedar",
   	"policySet": "
   			permit (
    			principal == BankA::User::\"696d28c8-8912-41d2-b182-aa7087323318\",
    			action in [BankA::Action::\"initiate\", BankA::Action::\"status\", BankA::Action::\"cancel\"],
    			resource == Creditor::\"https://example.com/payments\"
				)
				when { context.instructedAmount.currency == \"EUR\" &amp;&amp;
    			context.instructedAmount.amount == decimal(\"123.50\") &amp;&amp;
    			resource.creditorName == \"Merchant A\" &amp;&amp;
    			resource.creditorAccount.iban == \"DE02100100109307118603\" &amp;&amp;
 		   		context.remittanceInformationUnstructured == \"Ref Number Merchant\"
				};
			"
	}
]
</sourcecode>
</figure>
<t indent="0" pn="section-2-6"><xref target="figure3" format="default" sectionFormat="of" derivedContent="Figure 3"/> shows a combined request asking for access to account information and permission to initiate a payment:</t>
      <figure anchor="figure3" align="left" suppress-title="false" pn="figure-3">
        <name slugifiedName="name-example-of-authorization_det">Example of "authorization_details" for a Combined Request
</name>

 <sourcecode type="json" markers="false">
[
 {
   "type": "account_information"
   "rarFormat": "cedar",
   "policySet": "
   		permit (
    		principal == BankA::User::\"696d28c8-8912-41d2-b182-aa7087323318\",
    		action in [BankA::Action::\"list_accounts\", BankA::Action::\"read_balances\", BankA::Action::\"read_transactions\"],
    		resource == BankA::\"https://example.com/accounts\"
			);
		"
	},
	{
   	"type": "payment_initiation"
   	"rarFormat": "cedar",
   	"policySet": "
   			permit (
    			principal == BankA::User::\"696d28c8-8912-41d2-b182-aa7087323318\",
    			action in [BankA::Action::\"initiate\", BankA::Action::\"status\", BankA::Action::\"cancel\"],
    			resource == Creditor::\"https://example.com/payments\"
				)
				when { context.instructedAmount.currency == \"EUR\" &amp;&amp;
    			context.instructedAmount.amount == decimal(\"123.50\") &amp;&amp;
    			resource.creditorName == \"Merchant A\" &amp;&amp;
    			resource.creditorAccount.iban == \"DE02100100109307118603\" &amp;&amp;
 		   		context.remittanceInformationUnstructured == \"Ref Number Merchant\"
				};
			"
	}
]
</sourcecode>
      </figure>
	</section>
	<section anchor="token-response" numbered="true" removeInRFC="false" toc="include" pn="section-7">
      <name slugifiedName="name-token-response">Token Response</name>
			<t>
			The authorization_details parameter in a Rich Authorization Request token response MAY contain the field "rarFormat" and that field MUST equal the value "cedar".
			</t>
      <t indent="0" pn="section-7-3">The AS <bcp14>MAY</bcp14> respond with policies in the <tt>authorization_details</tt> to the client which are less permissive than the policies requested.</t>
      <t indent="0" pn="section-7-4">For our running example, it would look like this:</t>
      <figure align="left" suppress-title="false" pn="figure-4">
        <name slugifiedName="name-example-token-response">Example Token Response</name>
        <sourcecode type="http-message" markers="false" pn="section-7-5.1">
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
   "access_token": "2YotnFZFEjr1zCsicMWpAA",
   "token_type": "example",
   "expires_in": 3600,
   "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",
   "authorization_details": [
      {
   			"type": "payment_initiation"
  		 	"rarFormat": "cedar",
  		 	"policySet": "
 	  			permit (
  	  			principal == BankA::User::\"696d28c8-8912-41d2-b182-aa7087323318\",
    				action in [BankA::Action::\"initiate\", BankA::Action::\"status\", BankA::Action::\"cancel\"],
    				resource == Creditor::\"https://example.com/payments\"
					)
					when { context.instructedAmount.currency == \"EUR\" &amp;&amp;
    				context.instructedAmount.amount == decimal(\"123.50\") &amp;&amp;
    				resource.creditorName == \"Merchant A\" &amp;&amp;
    				resource.creditorAccount.iban == \"DE02100100109307118603\" &amp;&amp;
 		   			context.remittanceInformationUnstructured == \"Ref Number Merchant\"
					};
				"
			}
   ]
}
</sourcecode>
      </figure>
		</section>
			

		

		<section anchor="SecurityConsiderations" title="Security Considerations">
			<t>
			[[todo]]
			</t>
		</section>
		<section anchor="PrivacyConsiderations" title="Privacy Considerations">
			<t>
			[[todo]]
			</t>
		</section>



		<section anchor="IANA" title="IANA Considerations">
			<t>
			[[todo]]
			</t>
		</section>

	</middle>

	<back>
		<references title="Normative References">

		</references>

		<references title="Informative References">

		</references>

		<section anchor="Acknowledgements" title="Acknowledgements">
			<t>
       [[todo]]
			</t>
		</section>

		<section anchor="History" title="Document History">

		</section>     

	</back>
</rfc>
