Re: [OAUTH-WG] Transaction Authorization with OAuth (Torsten Lodderstedt)

Justin Richer <jricher@mit.edu> Wed, 15 May 2019 18:39 UTC

Return-Path: <jricher@mit.edu>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 098451206DA for <oauth@ietfa.amsl.com>; Wed, 15 May 2019 11:39:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.89
X-Spam-Level:
X-Spam-Status: No, score=-1.89 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_MIME_MALF=0.01] autolearn=unavailable autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rOHJ2qb2Ylva for <oauth@ietfa.amsl.com>; Wed, 15 May 2019 11:39:02 -0700 (PDT)
Received: from outgoing-exchange-7.mit.edu (outgoing-exchange-7.mit.edu [18.9.28.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D679612069F for <oauth@ietf.org>; Wed, 15 May 2019 11:38:46 -0700 (PDT)
Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-7.mit.edu (8.14.7/8.12.4) with ESMTP id x4FIceT9000969; Wed, 15 May 2019 14:38:42 -0400
Received: from oc11expo18.exchange.mit.edu (18.9.4.49) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Wed, 15 May 2019 14:38:12 -0400
Received: from oc11expo18.exchange.mit.edu (18.9.4.49) by oc11expo18.exchange.mit.edu (18.9.4.49) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Wed, 15 May 2019 14:38:30 -0400
Received: from oc11expo18.exchange.mit.edu ([18.9.4.49]) by oc11expo18.exchange.mit.edu ([18.9.4.49]) with mapi id 15.00.1365.000; Wed, 15 May 2019 14:38:30 -0400
From: Justin Richer <jricher@mit.edu>
To: George Fletcher <gffletch=40aol.com@dmarc.ietf.org>
CC: Pedro Igor Silva <psilva@redhat.com>, Jaap Francke <jaap.francke=40iwelcome.com@dmarc.ietf.org>, "oauth@ietf.org" <oauth@ietf.org>
Thread-Topic: [OAUTH-WG] Transaction Authorization with OAuth (Torsten Lodderstedt)
Thread-Index: AQHU+zhINZZlusRlskuXC59Zp2p6IqZOvx+AgAAJo4CAHh6egA==
Date: Wed, 15 May 2019 18:38:30 +0000
Message-ID: <6DB0AFDC-5637-4CC2-AB43-7BECDBF978DB@mit.edu>
References: <mailman.71.1556132414.19667.oauth@ietf.org> <74A378B3-B81A-4199-938B-E576FD1AA66C@iwelcome.com> <CAJrcDBcidbp11ozU5CNcY_OEY_XeSnaYih3_bJ1_w=9vZ+8NRA@mail.gmail.com> <1099fde4-1bca-d521-30cb-65bf834d0d86@aol.com>
In-Reply-To: <1099fde4-1bca-d521-30cb-65bf834d0d86@aol.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [71.174.62.56]
Content-Type: multipart/alternative; boundary="_000_6DB0AFDC56374CC2AB437BECDBF978DBmitedu_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/RyHDrOn1dcQ8AkzjY_ouqwxI5Gs>
Subject: Re: [OAUTH-WG] Transaction Authorization with OAuth (Torsten Lodderstedt)
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/oauth/>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 15 May 2019 18:39:05 -0000

I agree with separating these concerns, but not quite with the description of the goal of scopes. What a scope really represents, in my mind, is a shorthand for a set of capabilities available at an API. This shorthand is baked into the API and so needs to be useful across multiple clients and requests in order for it to be worth defining as a separate scope. With this proposal, things are tied more to the specific request and don’t need to be re-usable.

Both concepts are useful, though, and this is something I’ve added in the XYZ strawman proposal (https://oauth.xyz/): a regular request has a “resources” section which would be structured like Torsten’s structured scope idea, but with the concept of the “handle” introduced in XYZ you get a couple of interesting elements. First, an API can pre-define a set of handle strings that the client can use in its request, much like scopes are used today. These would be the more general-purpose resource sets. But then a client making a more specific request can be issued a randomly-generated handle that only it can use, and the AS can look up that handle’s value and tie it to the original requested resource set. This is effectively a “scope” but specifically for the client’s specific request.

I’d also like to point out that the “claim_token” idea below is exactly what’s done with UMA 2’s “permission ticket” response from the RS, and that is passed along to the AS with the token request in UMA. This same pattern can happen with XYZ, for what it’s worth, with the RS returning a resource handle that the client can send along with its own resources request.

— Justin

On Apr 26, 2019, at 10:41 AM, George Fletcher <gffletch=40aol.com@dmarc.ietf.org<mailto:gffletch=40aol.com@dmarc.ietf.org>> wrote:

I agree that we definitely need better definition and guidance around scopes and authorized access patterns.

I think what is unique about what Torsten is proposing is that in his case he wants to authorize an individual transaction (not a set of transactions). Normally, with scopes and access tokens the goal is to get an access token that can perform a number of transactions with a restricted set of capabilities.

I think we need to separate the concept of transactional authorization from capability authorization.

On 4/26/19 10:06 AM, Pedro Igor Silva wrote:
Hi Jaap,

Very good points. I have the same opinion about what you said about the meaning of scopes (and how people are actually using them), the resource-scope relationship and the importance of a standardized way of doing this form of authorization to address different use cases, not only delegation. Like George said in one of his messages, both 1st and 3rd party use cases could be considered by a solution like that.

I would love to see something based on OAuth like this:

#1) Client tries to access a protected resource. At this point, the client does not yet have a bearer token or the bearer token is lacking the required scopes/permissions. The resource server responds with:

HTTP/1.1 403 Unauthorized??
WWW-Authenticate: Bearer realm="example", error="invalid_token",??claim_token="accVkjcJyb4BWCxGsndESCJQbdFMogUC5PbRDqceLTC"

The claim_token response parameter returned by the resource server represents all the security constraints (e.g.: scopes) and information (e.g.: contextual) that the client needs in order to obtain a valid access token from the AS. This token can be built by the RS or even use some endpoint at the AS, as UMA does. It can be just a reference token too.

#2) Client obtains an access token from the token endpoint at the AS:

POST /as/token.oauth2 HTTP/1.1
Host:??as.example.com<http://as.example.com/>
Content-Type: application/x-www-form-urlencoded
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apermission
&resource=https%3A%2F%2Fbackend.example.com<http://2fbackend.example.com/>%2Fapi%20
&claim_token=accVkjcJyb4BWCxGsndESCJQbdFMogUC5PbRDqceLTC
&subject_token=accVkjcJyb4BWCxGsndESCJQbdFMogUC5PbRDqceLTC
&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token

The example above shows a client request to the token endpoint when the client already has an access token and wants a new token with permissions to access a resource.

#3) Just like any other OAuth grant type, the token endpoint responds to the client as follows (success):

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
"access_token":"2YotnFZFEjr1zCsicMWpAA"
"token_type":"example",
"expires_in":3600,
"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA"
}??

#4) Clients can now access protected resources using the access token with all permissions granted by the server

It is not coincidence the similarities with and the usage of specs/drafts like token exchange, resource-indicator, UMA,??Lodging Intent Pattern,??or even ACE's "AS Request Creation Hints" message. The point I would like to make is that we could leverage the standards/specs that exist today to address the problem without reinventing the wheel.

There are very interesting things in UMA specs that can be used here too, such as the possibility to perform incremental authorization or token upgrade, etc.

Regards.
Pedro Igor

On Thu, Apr 25, 2019 at 4:27 AM Jaap Francke <jaap.francke=40iwelcome.com@dmarc.ietf.org<mailto:40iwelcome.com@dmarc.ietf.org>> wrote:
Hi Torsten and others,

I just read your blog - having ???we need to re-think OAuth scopes??? in the title immediately drew my attention.??
I find this interesting since I???m struggling with the concept of scopes from time-to-time.
I???ll have to read the blog a few times more to get a good understanding, but I would like to share some of my thoughts on scopes.

I believe the OAuth scope concept has it???s limitations not only for transactions but also for the more traditional ???resource??? concept.
RFC 6749 defines scopes as follows:
"The value of the scope parameter is expressed as a list of space-
???? delimited, case-sensitive strings.?? The strings are defined by the
???? authorization server.?? If the value contains multiple space-delimited
???? strings, their order does not matter, and each string adds an
???? additional access range to the requested scope.???

I see 2 aspects in this definition:
- how the strings should look like is beyond the scope of the RFC
- each string adds an additional authorisation

Scopes are associated with access_tokens, which typically are bearer tokens as defined by RFC 6750 as:
?????????? A security token with the property that any party in possession of
?????????? the token (a "bearer") can use the token in any way that any other
?????????? party in possession of it can.?? Using a bearer token does not
?????????? require a bearer to prove possession of cryptographic key material
?????????? (proof-of-possession).???

This implies that every scope value should fully describe the authorisation that is given. In my view that is rarely done, which is the main reason why I find myself struggling with scope-concept.

Here we have a collection of examples, which demonstrate to me that everyone is inventing their own wheels according to their specfic needs:
https://brandur.org/oauth-scope
https://api.slack.com/docs/oauth-scopes

In various other (draft) standards I see bits and pieces that seem to address this issue.

In UMA an authorisation is conceptually broken down into:
- subject -> requesting party
- verbs -> scopes of access
- object -> resource set.
I like this line of thinking and terminilogy.?? However, if access_tokens are bearer tokens, I think ???subject??? is the bearer of the token.


The most common practice, I think, is to use OIDC???s IDTokens to contain a set of claims that scope the scope of the scope :-).??

I mean that the claims in the ID-Tokens are used to scope the objects as well as the verbs/scopes of access.

The core intention behind ID-token is to provide information about the authenticated user and not necessarily about the resources that are accessed. In practice, claims about the authenticated users indicate which resources (photos) can be accessed at the resource server.




My understanding of this draft https://tools.ietf.org/html/draft-ietf-oauth-resource-indicators-02

is that the object/resource aspect of authorisation is taken somewhat out of the scope and put into a dedicated parameter. Although (using the example from RFC 6749) the resource parameter indicates the resource server (or application,

   API, etc.) rather than an individual resource that is stored at the resource server. So additional scoping of object/resource set is still needed in addition to the resource parameter.


Furthermore,??https://tools.ietf.org/html/draft-ietf-oauth-security-topics-12??makes some interesting statements that are relevant in my view:
The section on Access Token privilege restriction says "access tokens SHOULD be restricted to certain resources

   and actions on resource servers or resources.??? So the OAuth scope-string still needs to somehow indicate the resource-scope of the privilege that is communicated.




" The client needs to tell the authorization server, at which URL it

   will use the access token it is requesting.  It could use the
   mechanism proposed [I-D.ietf-oauth-resource-indicators<https://tools.ietf.org/html/draft-ietf-oauth-security-topics-12#ref-I-D.ietf-oauth-resource-indicators>] or encode the
   information in the scope value.???

I???m not sure which point I???m trying to make; i guess the need for standardisation how to use and define OAuth-scopes.

I like the Lodging Intent Pattern and need to do some more reading/thinking about the structured-scope and pushed request objects.

I feel these concepts are not only relevant for authorisation of transactions, but also for any access that needs authorisation.




I???m not sure if i express myself clearly, nevertheless any feedback is welcome, if not alone to get my understanding of the various concepts on a higher level.




Thanks in advance, kind regards




Jaap





Message: 1
Date: Wed, 24 Apr 2019 19:08:25 +0200
From: Torsten Lodderstedt <torsten@lodderstedt.net<mailto:torsten@lodderstedt.net>>
To: Sascha Preibisch <saschapreibisch@gmail.com<mailto:saschapreibisch@gmail.com>>
Cc: oauth <oauth@ietf.org<mailto:oauth@ietf.org>>
Subject: Re: [OAUTH-WG] Transaction Authorization with OAuth
Message-ID: <2997B550-C82B-4D3A-9639-15A004F2F6C5@lodderstedt.net<mailto:2997B550-C82B-4D3A-9639-15A004F2F6C5@lodderstedt.net>>
Content-Type: text/plain; charset=utf-8

Hi Sascha,

I see. I assume every element within the structured scope element to be an independent scope (value) object and intended to use the name of that object as kind of content type definition.

In my last example, the scope is defined as

????"structured_scope":{ ??
??????????"sign":{ ??
????????????????"credentialID":"qes_eidas",
????????????????"documentDigests":[ ??
??????????????????????{ ??
????????????????????????????"hash":
????????????????????????????????"sTOgwOm+474gFj0q0x1iSNspKqbcse4IeiqlDg/HWuI=",
????????????????????????????"label":"Mobile Subscription Contract"
??????????????????????}
????????????????],
????????????????"hashAlgorithmOID":"2.16.840.1.101.3.4.2.1"
??????????},
??????????"payment":{ ??
????????????????"type":"sepa-credit-transfer",
????????????????"instructedAmount":{ ??
??????????????????????"currency":"EUR",
??????????????????????"amount":"123.50"
????????????????},
????????????????"debtorAccount":{ ??
??????????????????????"iban":"DE40100100103307118608"
????????????????},
????????????????"creditorName":"Merchant123",
????????????????"creditorAccount":{ ??
??????????????????????"iban":"DE02100100109307118603"
????????????????},
????????????????"remittanceInformationUnstructured":"new Smartphone"
??????????}

This means ?sign" and ?payment" would determine the scheme of the respective object.

What do you think?

best regards,
Torsten.

On 23. Apr 2019, at 17:14, Sascha Preibisch <saschapreibisch@gmail.com<mailto:saschapreibisch@gmail.com>> wrote:

Hi Torsten!

If 'structured_scope' would become a generic field for application
specific content, I believe an indicator for the type of content would
be needed on the long run. That is what I meant my 'profile'. I hope
this helps!

Thank you,
Sascha

Am Mo., 22. Apr. 2019 um 22:06 Uhr schrieb Torsten Lodderstedt
<torsten@lodderstedt.net<mailto:torsten@lodderstedt.net>>:

Hi Sascha,

Am 22.04.2019 um 20:34 schrieb Sascha Preibisch <saschapreibisch@gmail.com<mailto:saschapreibisch@gmail.com>>:

Thank you for the article, Torsten!

my pleasure :-)


I like that 'scope' is out of the game for these kinds of authorizations.

What I can see for the general use case is a required identifier
within the 'structures_scope' document that identifies the profile it
should be used for.

What does profile mean in this context?

best regards,
Torsten.

Thank you,
Sascha

Am Sa., 20. Apr. 2019 um 11:21 Uhr schrieb Torsten Lodderstedt
<torsten@lodderstedt.net<mailto:torsten@lodderstedt.net>>:

Hi all,

I just published an article about the subject at: https://medium.com/oauth-2/transaction-authorization-or-why-we-need-to-re-think-oauth-scopes-2326e2038948<https://medium..com/oauth-2/transaction-authorization-or-why-we-need-to-re-think-oauth-scopes-2326e2038948>

I look forward to getting your feedback.

kind regards,
Torsten.
_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth



------------------------------

Subject: Digest Footer

_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth


------------------------------

End of OAuth Digest, Vol 126, Issue 58
**************************************

_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth



_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth


_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth