Re: [OAUTH-WG] OAuth2 Implementation questions (client secret and refresh tokens)

Phil Hunt <phil.hunt@oracle.com> Thu, 08 September 2011 00:07 UTC

Return-Path: <phil.hunt@oracle.com>
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 50AFC21F8D2D for <oauth@ietfa.amsl.com>; Wed, 7 Sep 2011 17:07:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.203
X-Spam-Level:
X-Spam-Status: No, score=-5.203 tagged_above=-999 required=5 tests=[AWL=1.395, BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hapkI72u-iiM for <oauth@ietfa.amsl.com>; Wed, 7 Sep 2011 17:07:17 -0700 (PDT)
Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by ietfa.amsl.com (Postfix) with ESMTP id CFB3721F8D21 for <oauth@ietf.org>; Wed, 7 Sep 2011 17:07:13 -0700 (PDT)
Received: from rtcsinet21.oracle.com (rtcsinet21.oracle.com [66.248.204.29]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p88091rB003930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Sep 2011 00:09:03 GMT
Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by rtcsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8808xnp011441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Sep 2011 00:09:00 GMT
Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8808sIR014551; Wed, 7 Sep 2011 19:08:54 -0500
Received: from [192.168.1.8] (/24.85.235.164) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Sep 2011 17:08:53 -0700
Mime-Version: 1.0 (Apple Message framework v1084)
Content-Type: multipart/alternative; boundary="Apple-Mail-20--21596376"
From: Phil Hunt <phil.hunt@oracle.com>
In-Reply-To: <CAGyXixz4oU7AbKF4vbiK4vBp4nncHm-YNrEEfzQpWc9G6mhBPw@mail.gmail.com>
Date: Wed, 07 Sep 2011 17:08:56 -0700
Message-Id: <59CDCC16-44BA-4626-B744-F1169A13A542@oracle.com>
References: <CAGyXixwZhMMTzWPrMeWQZEz0v_9WYGwPVByGfPAxGnAthf=3Ng@mail.gmail.com> <CAGyXixzH6uwf72ons1UE2-yKfx=TK-bSBSpN5TzmcJNPVcbxKg@mail.gmail.com> <1315434454.76681.YahooMailNeo@web31816.mail.mud.yahoo.com> <0F38FE37-5F91-48ED-AD9E-1F08B7AA8DA6@oracle.com> <CAGyXixz4oU7AbKF4vbiK4vBp4nncHm-YNrEEfzQpWc9G6mhBPw@mail.gmail.com>
To: Dave Rochwerger <daver@oldschoolindustriesllc.com>
X-Mailer: Apple Mail (2.1084)
X-Source-IP: rtcsinet21.oracle.com [66.248.204.29]
X-CT-RefId: str=0001.0A090205.4E6807A0.0060,ss=1,re=-2.300,fgs=0
Cc: Quizlet Dev Team <devteam@quizlet.com>, "oauth@ietf.org" <oauth@ietf.org>
Subject: Re: [OAUTH-WG] OAuth2 Implementation questions (client secret and refresh tokens)
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.12
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: Thu, 08 Sep 2011 00:07:19 -0000

See below...
Phil

@independentid
www.independentid.com
phil.hunt@oracle.com





On 2011-09-07, at 4:57 PM, Dave Rochwerger wrote:

> Hi Phil,
> 
> >> The client is then forced to periodically reauthenticate (without the user) before getting a new access token. 
> What benefit does that have?

The user does not have to be present.  
> 
> >> Refresh also gives the authzn server a chance to revoke access. Hence it is better to use shorter lived access tokens with long lived refresh tokens. 
> That doesn't follow - we can just as easily revoke the single long-lived access token.

As Eran points out, you'd have to have do a DB lookup to have true revocation. But, by having a short expiration time on the access token (say 1 hour or less), you get quasi-revocation which has to be re-validated after the access token expires and the client has to re-authenticate and provide a valid refresh token.  In this sense you get the best of a long-lived credential, combined with good key rotation and authorization re-verification without having to re-involve the end-user.

> 
> Dave.
> 
> On Wed, Sep 7, 2011 at 4:24 PM, Phillip Hunt <phil.hunt@oracle.com> wrote:
> You can also use a long lived refresh token in combination with a short access token. The client is then forced to periodically reauthenticate (without the user) before getting a new access token. 
> 
> Refresh also gives the authzn server a chance to revoke access. Hence it is better to use shorter lived access tokens with long lived refresh tokens. 
> 
> Phil
> 
> On 2011-09-07, at 15:27, William Mills <wmills@yahoo-inc.com> wrote:
> 
>> I'll talk to the refresh token question:  they give you a hook for extensibility and key rotation.  If you want to rotate your encryption keys or extend the data carried in the token in any way then you want to be able to cleanly refresh your tokens.  Note that the refresh flow allows you to issue a new refresh token at the same time.  It also allows a clean path to convert tokens in a new client if you decide you want SAML tokens instead of MAC for example.
>> 
>> If you want those things you want to use refresh tokens.  You can have long lived access tokens too, and just use the refresh tokens when you want to do something new with the access tokens.
>> 
>> -bill
>> 
>> From: Dave Rochwerger <daver@quizlet.com>
>> To: oauth@ietf.org
>> Cc: Quizlet Dev Team <devteam@quizlet.com>
>> Sent: Wednesday, September 7, 2011 2:15 PM
>> Subject: [OAUTH-WG] OAuth2 Implementation questions (client secret and refresh tokens)
>> 
>> Hi all,
>> 
>> I have been implementing OAuth2 based on the various drafts for our new API. Initially, I implemented everything as per the spec, but due to our particular scenario and restrictions we have in place, there are some fundamental questions that I am unable to defend.
>> 
>> I am hoping this group could help answer them for me.
>> 
>> Our scenario:
>> ==========
>> * We are implementing an API to allow 3rd party developers to access users' protected resources via their applications. The applications will mostly be native phone apps, but some will have web server backends (javascript-only applications are not a concern at the moment).
>> * We want to provide very long-lived (forever) tokens.
>> * We are implementing the "authorization code" flow as that seems best suited to us (we don't want the implicit flow because end-users would have to re-authorize every hour).
>> 
>> Our architecture:
>> ============
>> * We control both the API server and the authorization server.
>> * All requests to protected resources (ie: to the API server) are always done over SSL.
>> * All requests to the authz server (token and authorize endpoints) are always done over SSL.
>> * We enforce that every client must supply the state parameter (and our guidelines say they must verify the state for CSRF mitigation).
>> * We enforce that every client must register a redirect URI.
>> * We validate the redirect_uri used to request an access token is the same that was used to obtain the auth code.
>> * The only time a request is not made over SSL is the redirect with the auth_code which is very short-lived (30 seconds) and is tied to a verified redirect URI.
>> * We enforce that access tokens must be provided using the Authorization header only (and of course, over SSL).
>> * We have guidelines saying that all mobile apps must use the native browser (and not an embedded web UI).
>> 
>> Questions:
>> ========
>> 1. Given the above scenario, what use are refresh tokens?
>>   - Access tokens can not leak because every request (to resource and authz server) containing an access token is done over SSL. We control both the authz and resource servers, so tokens in logs (and other suggested reasons in the archives) are not an issue.
>>   - Long-lived refresh tokens and short-lived access tokens are supposed to provide security due to possible access token leakage... but in our 100% SSL scenario, if access tokens are able to leak, then so would the client id, secret and refresh token.
>>   - Having a long-lived refresh token that can be exchanged for another access token adds a level of complexity (a second HTTPS request every so often) and seems to provide no benefit for our case.
>> 
>> 
>> 2. What is the point of the client secret (in our scenario)? 
>> - We originally were treating the clients as confidential, but after re-reading the native-application section, it seems we really should treat them as public (phone apps can be decompiled and the secret discovered).
>> - The spec says that the authz server should authenticate confidential clients, but public clients are allowed to just send their public client id (and no secret).
>> - The only verification then, is to enforce redirect URI registration and to validate the redirect URI between authorization and token steps.
>> 
>> So, the question is, assuming that we, one: "enforce redirect-URI registration" and two: "validate that URI" - why can't we treat all clients as public and not worry about a secret?
>> What is the benefit of having confidential clients (and a secret) at all? 
>> 
>> 
>> Our API source is not available, but the oauth2 server implementation can be seen here: https://github.com/quizlet/oauth2-php
>> 
>> Regards,
>> Dave
>> 
>> 
>> _______________________________________________
>> OAuth mailing list
>> OAuth@ietf.org
>> https://www.ietf.org/mailman/listinfo/oauth
>> 
>> 
>> _______________________________________________
>> OAuth mailing list
>> OAuth@ietf.org
>> https://www.ietf.org/mailman/listinfo/oauth
>