Re: [OAUTH-WG] Token Chaining Use Case

Mike Jones <> Wed, 08 July 2015 22:10 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id 284FF1A8896 for <>; Wed, 8 Jul 2015 15:10:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id ER_ZorJPxu50 for <>; Wed, 8 Jul 2015 15:10:06 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 507B91A883C for <>; Wed, 8 Jul 2015 15:10:06 -0700 (PDT)
Received: from ( by ( with Microsoft SMTP Server (TLS) id; Wed, 8 Jul 2015 22:10:05 +0000
Received: from ( by ( with Microsoft SMTP Server (TLS) id; Wed, 8 Jul 2015 22:09:59 +0000
Received: from ([]) by ([]) with mapi id 15.01.0213.000; Wed, 8 Jul 2015 22:09:59 +0000
From: Mike Jones <>
To: Brian Campbell <>
Thread-Topic: [OAUTH-WG] Token Chaining Use Case
Thread-Index: AQHQZ/MY5K5Dp0IvikmgQJJzAhL8fZ0vVM6AgKHjaSCAABZagIAABdjQgAFFh4CAACahcA==
Date: Wed, 8 Jul 2015 22:09:59 +0000
Message-ID: <>
References: <> <> <> <> <> <>
In-Reply-To: <>
Accept-Language: en-US
Content-Language: en-US
authentication-results:; dkim=none (message not signed) header.d=none;
x-originating-ip: [2001:4898:80e8:ed31::4]
x-microsoft-exchange-diagnostics: 1; BY2PR03MB443; 5:AuzeBKKj3Eq0cA/MWO9qK2EO9GyTzxZFyDkMXkKCY1pz19U0gVifDLeJOSVp9qDRaIjcBZNn9VZuUDTo/xSBaM+kn6APPlkgEROmq0fWh2S8wvjLtWKL9QRO4jh9d09DBy2nnogSjBKG3Ht9ZUxzng==; 24:pF1ljv+yOrjlqx/on99aGarYAs1ndETMrQbm21gT8SGhZUkSzozS8LH/IV48tWD8AIPMdWrJdWnqr1PGzZl84EXvXpa1/80OmEn515aWw+8=; 20:FLRFDznqD2Y6YjPdTnh1kGFELE4xR90rfWdRDbX5kwnOfwVET+HXeE6XyGS8NxxGFep7GQPrijBwZnBm8+qPaA==
x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY2PR03MB443; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY2PR03MB425;
by2pr03mb443: X-MS-Exchange-Organization-RulesExecuted
x-microsoft-antispam-prvs: <>
x-exchange-antispam-report-test: UriScan:(108003899814671);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401001)(5005006)(3002001); SRVR:BY2PR03MB443; BCL:0; PCL:0; RULEID:; SRVR:BY2PR03MB443;
x-forefront-prvs: 0631F0BC3D
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(209900001)(377454003)(51444003)(24454002)(53754006)(110136002)(19625215002)(40100003)(92566002)(16236675004)(15975445007)(5001960100002)(102836002)(77156002)(189998001)(54356999)(5003600100002)(33656002)(62966003)(15395725005)(86362001)(76176999)(86612001)(50986999)(77096005)(19300405004)(74316001)(99286002)(76576001)(19580405001)(2656002)(2950100001)(93886004)(106116001)(46102003)(2900100001)(19609705001)(87936001)(5002640100001)(19617315012)(122556002)(19580395003)(6606295002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR03MB443;; FPR:; SPF:None; MLV:sfv; LANG:en;
Content-Type: multipart/alternative; boundary="_000_BY2PR03MB4429DB920047BC96E894760F5910BY2PR03MB442namprd_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jul 2015 22:09:59.6369 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB443
X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB425; 2:/YQhLJk6HpURbw620q5g/ljFT8cpKlij58kFmlgx7C1szIzdkkAf2VAhPqkyRkcf; 3:dJ1l/OwVwTiM2M+iV3j/HUqiOuPG/YGs8VimTSplYh4OEeA5x1gXMTOWSSU1f8YEAZLXYxlxK/rmigxNoNmotxW3u0gzlaVbBDwGvcCeDbK+M/M7eEM7SvbLKCfKrOIVTOOnhMs9N0Owa8XOupgQgw==; 25:QEAz8n7tiVvmugvF/V9TT2s7PKyVrCGrp0zb6uoWcLxSj71akxPxVfNM3Aype+y3INA8GnHbrAYwpzeXdPZKH/RrYeNr6EWN86XLE5om5eob0q+yKFEtvN4mVPrSl8gbhH4S3cnkoehVhWPt8siYhuf0tbk7rLBB/GBqQScaPvHMA09PIP0tCLVfGd/T63yIg+9WdAFZdtJq505j83PqRKZyM/p5eosSNvfxIAH9x/iia6u5+0mYhUZqI4MpK5rMc44TeejuIkwga9jqxHVPuQ==
X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB425; 20:hhrB2HvaH5wbe13HgEn9JnD9iq1+SEB7CxQOdRTGBlr39gs4N+1noNbeLyDw3Qic5MmsTRrCa2Cvqt2NyEsG3uc8hh3qMFxlgvOvt/noMNLt4FhuTWdvJmQJgrUwibOSGHb+sPFIT7qm5nGo36mfjHh3uG7Nh04K979uZC3OcU1pqDhxxQWUyT1dTo6BUkSz2+uZ1LxTYMCvgbVa7MCX4gxB0hiDHTIC6cOMKounupK0g9yh6A48ESNBjzU8crO2bk3Im59eUAFGMCDJ/1E7vTSsrFeLFK1JXYGSwavvrMwB6UeGbQyCRQ4xCDSiQQXgjkgb+HVN5j3TJ9EflfsINvIcYu+enh6aOzbEAw2n6mM+LXLBJbxp3NSlAxybMQIv+UYldfHjtx2FmmEE5ggW9rwUEO6IAu3ZTib1c76ZotknJ7xIOKRwX6xKFr8es5bPb6VG7BYmJbADYy51BQkP6mY66SeGjcwgTTTnrzeEBZk04kUarhcajdjJ9b1Eo4qy; 23:Ew8ousNeiJ4Ytvq+DjTtT9fd3OzMo+0YX0Eayva7OVlZdsH9Z8Vw7zfwfnQXaVjs5g+k5/g0SETW5JgHdAK5N7OvlpYAx0xC+cX5gdzLB4s32vER/wZqEkDLOP9xvg+X9HpywsCSxE4Ff5gRJQpHcbkkTBYR37Ipr5dgG/oVgO4KP8ZoRIPCrETATdqLuuDVnZQs80wY9/ibD951bswM2j//EPYglsO1Y9ljx3a79n6UZrsVj+ev/1JRFPtbDSJu
Archived-At: <>
Cc: "<>" <>
Subject: Re: [OAUTH-WG] Token Chaining Use Case
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: OAUTH WG <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 08 Jul 2015 22:10:13 -0000

Hi all.  After reading Brian’s note, he and I spoke on the phone to try to clear a few things up and work on a collaborative path forward.  Here’s some of what we talked about…

First, I’m sorry that I may have contributed to the impression that there’s little willingness on my part to consider changes to the draft.  That’s not the case and the truth is actually much simpler than that…  I’d been super-busy doing other things, including finishing JWT, JOSE, OAuth Assertions, helping develop and launch the OpenID Certification program<>n/>, and several other valuable things, and I simply hadn’t given token exchange any significant bandwidth for a while as a result.  Now that many of those things are done, I do have bandwidth to work on it now.

One concrete thing Brian and I agreed to do as a next step is to work on a list of issues and choices for the working group to consider together, which we’ll jointly present in Prague.  Hopefully that will help reduce some of the confusion and replace it with a clear an actionable engineering analysis of the options available to us.

I know we both share the goal of keeping things as simple and efficient as possible, while enabling support for the token exchange use cases that different applications actually need.

One other thing that we both think would help people better understand and use the resulting spec is to have a number of clear, illustrative examples.  Face it, whatever you call it (delegation, impersonation, on-behalf-of, act-as, etc.), some of the concepts are subtle, and so the more we can shed light on them through concrete examples, the easier I suspect that we can make it for people to both understand what they are and how they apply to their use cases.

I’m looking forward to seeing many of you in Prague pretty soon!

                                                                -- Mike

From: Brian Campbell []
Sent: Wednesday, July 08, 2015 12:33 PM
To: Mike Jones
Cc: Justin Richer; <>
Subject: Re: [OAUTH-WG] Token Chaining Use Case

There is a lot in common, yes. Fundamentally we're working to address the same needs, which should lead to some commonality. But I was also trying to be conciliatory in the work I did and make a good faith effort at establishing some commonality from which collaborative work could move forward. In retrospect I should probably have just outright opposed the adoption of draft-jones-oauth-token-exchange as a WG item. I thought trying to work with you would be more effective than working against you. At the time you seemed amenable to that and even proposed co-editing with. Hannes followed that indicating support for adding other co-authors (he didn't say it but kind of implied perhaps Justin and/or Phil based on prior related work). Since that time, however, there's been little willingness to consider changes to the draft (other than very trivial items). And Tony was added as a co-author, which to me (and I suspect many others) signals a complete lack of willingness to actually collaborate towards a solution that's acceptable to more than one contingent.
There are differences in the drafts too. I won't list them all here but did want to call out that, contrary to what you said, the request in my draft is made up of regular old HTTP form-urlencoded POST parameters. Which is a simplification and efficiently improvement that seems to be preferred.

On Tue, Jul 7, 2015 at 6:41 PM, Mike Jones <<>> wrote:
I’ll start by saying that if you compare and, unsurprisingly, you’ll find a lot in common.  Both have requests and responses formatted using JSON objects, both have input and output tokens, both have security token type parameters describing their corresponding inputs and outputs.  Both can convey act_as and on_behalf_of tokens.  And despite what was written below, both define a new grant_type value that is used to make this new kind of request at the Token Endpoint.

The primary thing that Brian’s draft is missing semantically is the ability for the requester to sign the set of input parameters.  This is critical to establishing proper trust to enable the exchange to occur in many use cases.  That’s why the WG draft uses a JWT as the request – so a signature can be applied to the request, when appropriate.  (And when it’s not needed, “alg”: “none” can be used.)

Justin, you’re right that the current WG draft doesn’t have a separate “input token” request parameter.  In the current draft, the (optionally) signed request *is* the input token.  Thinking some more about the token chaining use case you’re interested in, I see why you want to have that token to be a separate element in the request.  I believe the best way to accomplish that is to add an optional claim to the request that would contain that token.  (I think the closest equivalent in Brian’s draft is the possibility of using an access token or assertion as the client authentication mechanism, possibly passing it as defined in RFC 6750, although the draft doesn’t say that.)  Passing the input token as a claim lets it be part of the signed request.

It’s completely up to us when using a different grant_type to define what the input and output parameters when using that grant_type are.  (RFC 6749 already has different sets, depending upon the grant_type used.)  I personally find it cleaner to return the output security token that may not be an access token in a “security_token” parameter rather than repurposing the “access_token” parameter to hold something that’s not an access token, but now we’re more discussing syntax than semantics.  Still, if something is different, it’s probably less error prone to use a different syntax for it.

I’m sympathetic to your comment about Nat’s signed requests draft, except that the requests that draft specifies are requests to the interactive Authorization Endpoint, whereas the requests we’re dealing with here are requests to the non-interactive Token Endpoint.  Still, thinking of the Token Exchange requests as signed requests to the Token Endpoint, just like Nat’s draft makes signed requests to the Authorization Endpoint, is probably a good unifying mental framework for all of us to consider applying to this problem space.

                                                                Best wishes,
                                                                -- Mike

From: Justin Richer [<>]
Sent: Tuesday, July 07, 2015 4:47 PM
To: Mike Jones
Cc: Brian Campbell; <<>>

Subject: Re: [OAUTH-WG] Token Chaining Use Case

This approach is not a good fit for my use cases, and it’s still not  OAuth-y at all. It requires a specially-formed security assertion on the way in, which the client must understand and generate. I still can’t take an arbitrary token I’ve been handed by someone else and pass it off to be pushed forward. The new “*_type” parameters seem to merely kick the can down the road instead of addressing the problems with the current specification.

I think that Brian’s approach works much better. It unrolls important parameters, properly uses the token endpoint, and allows for arbitrarily formatted input tokens.

When combined with Nat’s draft that specifies how to perform all generic OAuth requests as JWTs (or even some of the upcoming PoP work if we ever do that), you’ve pretty much got the draft below but with much more flexibility and power.

 — Justin

On Jul 7, 2015, at 6:51 PM, Mike Jones <<>> wrote:

As just updated<>, I believe that the working group token exchange draft can now also serve the “OAuthy” token exchange use cases, such as Justin and Phil’s token chaining use case, as well as support general token exchange, including exchange of JWT and SAML tokens.  The mechanism would be the same one that Brian suggested below – defining security token type values for OAuth 2.0 access tokens and refresh tokens – enabling them to be used as inputs and outputs in any of the token exchanges.

For instance, by using “access token” as the input security token type, providing new scope values, and using “access token” as the output security token type, token chaining is achieved.

Now, a question for the working group…  What should the security token type values for access token and refresh token be?  Two different choices seem to make sense.
(1)  Use the values “access_token” and “refresh_token”, which are used in RFC 6749 token response values.
(2)  Define new URNs for this usage, such as urn:ietf:params:oauth:token-type:access-token and urn:ietf:params:oauth:token-type:refresh-token.

I’d personally be fine just using the short names in (1).

If people agree with this approach, we can document this usage in the -03 draft and publish it as soon as the submission tool reopens Monday morning during IETF 93.

                                                                -- Mike

From: OAuth [] On Behalf Of Brian Campbell
Sent: Thursday, March 26, 2015 3:15 PM
To: Justin Richer
Cc: <<>>
Subject: Re: [OAUTH-WG] Token Chaining Use Case

This kind of token exchange might involve exchanges other than swapping an AT for another AT (and downscoping it). It might be an AT for a structured JWT specifically targeted at one of the the particular services that the original RS needs to call. Or an AT might be exchanged for a SAML assertion to use with legacy SOAP serveries.  A good general token exchange mechanism enables lots of variations of cases like the one Justin mentioned. And more. In fact, I think downscoping might be a minority use case where what token exchange is often need for is translating tokens from what you have into what the resource you need to call can deal with.
There need to be ways for the caller to tell the AS about the token it's asking for - by type or by the address/identifier of where it'll be used. There needs to be ways for the caller to authenticate to the AS. And there needs to be some way of expressing this delegation thing (though I'm still not totally convinced it couldn't be just the token is about the user/principal and the caller/client of the exchange is who is being delegated to).
I realize few (approaching zero) people have or are going to read it but I have endeavored to cover all these things in the draft. It's an early draft so not without it some rough edges but can provide some guidance on what is needed and offers some protocol syntax for expressing it. I believe Justin's use case would be covered by it (defining a specific token type URI for an OAuth access token issued by the AS in question might be needed) as are many others.

On Thu, Mar 26, 2015 at 1:31 PM, Justin Richer <<>> wrote:
As requested after last night’s informal meeting, here is the token chaining use case that I want to see represented in the token swap draft.

[ Client ]  ->   [ A ] -> [ B ] -> [ C ]

An OAuth client gets an access token AT1, just like it always would, with scopes [A, B, C] in order to call service A, which requires all three scopes. Service A (an RS) accepts this token since it has its scope, and then needs to call service B in turn, which requires scopes [B, C]. It could just re-send the token it got in, AT1, but that would give the downstream RS the ability to call services with scope [ A ] and it should not be allowed to do that. To limit exposure, service A calls a token swap at the AS to create AT2 with scopes [ B, C ], effectively acting as an OAuth client requesting a downscoped token based on AT1. Service A then acts as an OAuth client to call service B, now acting as an RS to service A’s client, and can fulfill the request. And it’s turtles all the way down: Service B can also call service C, and now B acts as a client, requesting AT3 with scope [ C ] based on AT2, and sending AT3 to service C. This prevents C from being able to call B or A, both of which would have been available if AT1 had been passed around. Note that service A or the Client can also request a downscoped token with [ C ] to call service C directly as well, and C doesn’t have to care how it got there.

In other words, it lets the client software be very, very dumb. It doesn’t have to do any special processing, doesn’t have to know what’s in the token, it just follows the recipe of “I got a token, I get another token based on this to call someone else”. It’s also analogous to the refresh token flow, but with access tokens going in and out. I’ve deployed this setup several times in different service deployments. Even though there is a performance hit in the additional round trips (as Phil brought up in another thread), in these cases the desire to have the tokens hold least privilege access rights (smallest set of scopes per service) outweighed any performance hit (which was shown to be rather small in practice).

What I want is for the token swap draft to define or use a mechanism that allows us to do this. I think we can do that pretty easily by adjusting the token swap syntax and language, and explicitly calling out the semantic processing portion (the current core of the document) for what it is: a way for a token issuer to communicate to a token service specific actions. At a high level, the spec would be something like:

1. How to swap a token at an AS
  1. Send a request to the token endpoint with a new grant type, and a token (of any type/format/flavor) on the way in
  2. Get back a new token in a token response
2. Communicating act as / on behalf of semantics via a JWT assertion
  1. How to create (as an AS/RS/client/other issuer) a JWT with act-as semantics
  2. What to do (as an AS/RS) with a JWT with act-as semantics
  3. How to create a JWT with on-behalf-of semeantics
  4. What to do with a JWT with on-behalf-of-semantics
  5. How to possibly represent these semantics with something other than a JWT

Section 2 uses the syntax from section 1. Other applications, like the one I laid out above, can use the syntax from section 1 as well. This works for structured, unstructured, self-generated, cross-domain, within-domain, and other tokens.

 — Justin

OAuth mailing list<>