Re: [OAUTH-WG] Returning tokens directly to a human user

Justin Richer <jricher@mit.edu> Fri, 06 March 2015 22:47 UTC

Return-Path: <jricher@mit.edu>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AE0711A1AA1 for <oauth@ietfa.amsl.com>; Fri, 6 Mar 2015 14:47:25 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.211
X-Spam-Level:
X-Spam-Status: No, score=-4.211 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
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 E-zdJ1Biz1zz for <oauth@ietfa.amsl.com>; Fri, 6 Mar 2015 14:47:22 -0800 (PST)
Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu [18.7.68.36]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9EE881A0AF1 for <oauth@ietf.org>; Fri, 6 Mar 2015 14:47:22 -0800 (PST)
X-AuditID: 12074424-f79356d000004839-78-54fa2e799c09
Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 61.D9.18489.97E2AF45; Fri, 6 Mar 2015 17:47:21 -0500 (EST)
Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id t26MlKjj027590; Fri, 6 Mar 2015 17:47:20 -0500
Received: from artemisia.richer.local (static-96-237-195-53.bstnma.fios.verizon.net [96.237.195.53]) (authenticated bits=0) (User authenticated as jricher@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id t26MlI6i002135 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 6 Mar 2015 17:47:19 -0500
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\))
Content-Type: multipart/signed; boundary="Apple-Mail=_D03FCD37-6B21-46F6-A164-FAA7E1703F59"; protocol="application/pgp-signature"; micalg="pgp-sha1"
X-Pgp-Agent: GPGMail 2.5b5
From: Justin Richer <jricher@mit.edu>
In-Reply-To: <54FA2AD7.7000500@gmail.com>
Date: Fri, 06 Mar 2015 17:47:17 -0500
Message-Id: <8E4D4A6C-A5CC-44E2-9AD3-7C9859F4D05C@mit.edu>
References: <54F59359.5020601@gmx.net> <2A7D9B45-2459-4558-8356-CAB1029D113D@MIT.EDU> <4E1F6AAD24975D4BA5B1680429673943A2E78D9F@TK5EX14MBXC292.redmond.corp.microsoft.com> <, > <54F7C2B7.7090304@mit.edu> <4E1F6AAD24975D4BA5B1680429673943A2E79640@TK5EX14MBXC292.redmond.corp.microsoft.com> <54F9E246.70901@gmail.com> <52A4984A-5ACE-472D-986D-54012EB620C2@mit.edu> <54FA2AD7.7000500@gmail.com>
To: Sergey Beryozkin <sberyozkin@gmail.com>
X-Mailer: Apple Mail (2.2070.6)
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAKsWRmVeSWpSXmKPExsUixG6nolup9yvE4NNrfouTb1+xWfxbau/A 5LFz1l12jyVLfjIFMEVx2aSk5mSWpRbp2yVwZUz6uI254L1lxYVFzxkbGOfpdzFyckgImEhc mHyfHcIWk7hwbz1bFyMXh5DAYiaJi8f+sIIkhAQ2MEpceKoOkXjAJDFh9QomkISwgKPEgU0b WEBsXgEDibmnvjCBFDELTGKUuHP/AdRYKYkHt9cwgthsAqoS09e0gDVzCmhKbHrwEWwDi4CK xN7/F4HiHEDN6hLtJ10gZlpJ9O7azw6xuJVZYuPMyWBzRAS0JS6+vsUOUi8hIC/Rsyl9AqPg LCRnzEJ2BkiCGahl2cLXzBC2psT+7uUsELa8xPa3c6DilhKLZ96AittK3OpbwARh20k8mraI dQEjxypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdc73czBK91JTSTYzgyHFR2cHYfEjpEKMAB6MS D2+H1M8QIdbEsuLK3EOMkhxMSqK8F9V/hQjxJeWnVGYkFmfEF5XmpBYfYlQB2vVow+oLjFIs efl5qUoivFOVgep4UxIrq1KL8mHKpDlYlMR5N/3gCxESSE8sSc1OTS1ILYLJynBwKEnwqukC NQoWpaanVqRl5pQgpJk4OA8xSnDwAA23AqnhLS5IzC3OTIfIn2JUlBLnfakDlBAASWSU5sH1 whLeK0ZxoLeEeTNA2nmAyRKu+xXQYCagwVpiP0AGlyQipKQaGKVMn/a12sz6n7IvaKtr/XKx a9U/V5nkFjxM0YkQ/KBWsELqx7XKXYXTkh7W7xB5zsFxzFDp+6f0m20TbaR+ZQUoLJz96FLQ jhbBKY/Fpk/be/LPn4zTyjraz3hKLmmvtjwUf0vNdsrTaZdutOZGVcgf//ahMP79o8jSyHbd 19/flCzTjE+tilViKc5INNRiLipOBADQ6oBXUwMAAA==
Archived-At: <http://mailarchive.ietf.org/arch/msg/oauth/1Aa9MlzLF1fU_CyZSJRjgwOvE3g>
Cc: "<oauth@ietf.org>" <oauth@ietf.org>
Subject: Re: [OAUTH-WG] Returning tokens directly to a human user
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Fri, 06 Mar 2015 22:47:25 -0000

> On Mar 6, 2015, at 5:31 PM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
> 
> Hi
> On 06/03/15 18:28, Justin Richer wrote:
>> All you’re really doing here is having a more manual and less automated portion for part of the process. You’d want to do this using a registered redirect URI that hosts the HTML page, and then you’d need a control in the app itself where the user could interact.
>> 
>> I would personally recommend using this approach to move an authorization code manually instead of moving an access token. Assuming your client can access the auth server directly (using the backchannel, no browser), you should be able to POST to the token endpoint and get the token directly without the user having to handle it. The reason being that auth codes are client-limited and much more time-limited, and their leakage doesn’t immediately lead to leakage of API access.
>> 
> Right now this is what I'm considering, whether to restrict it to the client getting the tokens itself, with the inserted code, or indirectly, after the user does it. We already support the former for public clients, I guess in the latter case a token will also be linked to a client because a user will enter a client id when requesting a token.
> 
> Just not sure yet if a 3rd party client will be 'prepared' as you say to interact directly with AS, I guess it will be given that it is expected it should be able to refresh…

> 
> 
>> We had a similar approach with a limited client back in the OAuth 1.0 days, where we had an HTML page that would print the oauth_verify code on the screen that the user would type into the application. These days, on most platforms, it’s much easier to register a custom URL handler or use another system service to get the code directly that this hack has all but disappeared, at least in my view.
> 
> Can you give me a favor and clarify a bit what you mean when referring to a registered URL handler ? A user signs in, requests a code or a token for a specific client, AS returns it to the user directly. I guess it can redirect the user to some other web application which is where the user will interact and get the code or token. What a registered URL handler can change in this process, make it more automated ? (I understand working with the code is better in general…)

I mean not doing anything special with the OAuth grants: use the redirects that are already there, just do something special with the page you’re redirected to that will display the code/token to the user and instruct them to paste it into the client appropriately. It can even be a pretty static page, with a bit of javascript to pull off the return values.

So you could build it like this: the user starts off at some webpage that says “Authorize AppX” and clicks that. This redirects them to the authorization endpoint, just like normal. Note that this redirect will include the client ID and scopes and all that, just like normal. Then the user logs in, authorizes, and is redirected back to AppX’s redirect_uri, just like normal. This redirect URI will be on the same service that hosts the “start off” page, if you want, so you can even check the “state” value against a stored cookie or session for extra protection. That page pops off the code or token parameter and displays it to the user, telling them how to get it into the client. Once the code or token is in the client, it goes on its way.

This all works without changing OAuth at all, and the auth server and resource server can be completely off-the-shelf. You’re effectively splitting the client in half: there’s a web-based half that deals with the authorization redirect, and a native half that deals with the code/token swap and the protected API calls. You use a person to glue them together.

I’ve built this kind of thing before, and it works well until people fall apart moving the displayed code between the web page and the rest of the application. That’s why a lot of apps, where possible, have just gone to popping up a browser. Dick’s recommendation to look at settop boxes and other apps that *can’t* pop up a browser is a good recommendation.

 — Justin


> 
> Thanks, Sergey
> 
>> 
>>  — Justin
>> 
>>> On Mar 6, 2015, at 12:22 PM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
>>> 
>>> Hi All,
>>> 
>>> We might have a requirement to support a case where AS returns an access token directly to a human user, with the user subsequently configuring a confidential client with this token. The actual client is not capable of supporting a (more dynamic) code flow at this stage.
>>> 
>>> So it is nearly like an implicit code flow except that the user is asked upfront which clients can get the tokens allocated and the token is returned in the HTML response without redirecting and placing the token in a fragment.
>>> 
>>> Apparently a number of big providers do just that, let users allocate tokens for some clients with the users expected to copy the tokens into the confidential clients afterwards.
>>> 
>>> I'd like to ask, it is a reasonable approach, to have tokens transferred manually into the confidential client ?
>>> 
>>> Would it be more appropriate for a user to request a code and then copy it to the confidential client and expect it to get the tokens itself. I guess the problem here may be a code is short lived, but so is a typical access token - but the latter can be supported by a refresh one.
>>> 
>>> Another question: does it even qualify as an OAuth2 grant for token exchange, the process of a user pre-authorizing a client and getting not a code but tokens back ? I guess it does, so how a grant like this one would typically be called ? We'd have no problems with assigning some custom name to such a grant but curious how others approach it...
>>> 
>>> Thanks, Sergey
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> OAuth mailing list
>>> OAuth@ietf.org
>>> https://www.ietf.org/mailman/listinfo/oauth
>> 
>