Re: [OAUTH-WG] User-agent flow and pre-registered redirect_uri

Andrew Arnott <andrewarnott@gmail.com> Thu, 10 June 2010 15:35 UTC

Return-Path: <andrewarnott@gmail.com>
X-Original-To: oauth@core3.amsl.com
Delivered-To: oauth@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 0548D3A69B6 for <oauth@core3.amsl.com>; Thu, 10 Jun 2010 08:35:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.323
X-Spam-Level:
X-Spam-Status: No, score=-0.323 tagged_above=-999 required=5 tests=[AWL=-0.325, BAYES_50=0.001, HTML_MESSAGE=0.001]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X8FuYYdujd2C for <oauth@core3.amsl.com>; Thu, 10 Jun 2010 08:35:37 -0700 (PDT)
Received: from mail-gy0-f172.google.com (mail-gy0-f172.google.com [209.85.160.172]) by core3.amsl.com (Postfix) with ESMTP id 2E0E33A690C for <oauth@ietf.org>; Thu, 10 Jun 2010 08:35:34 -0700 (PDT)
Received: by gyh4 with SMTP id 4so22706gyh.31 for <oauth@ietf.org>; Thu, 10 Jun 2010 08:35:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=S35nEzbEROuvvM1QPs/szrlGUR5V3JGKI/oV6gvn5MQ=; b=MW1m/VIeo0CAc0IhshyulBS+0RilkjEAZH4Fa/KeW4AzTyslttuA6EbOtVmDk/1LaS PkMogV7Ef5Y9Ik+fjY8jhwFKDeD4SGcTZ2Uln+JlRqxX6R1CvEmWTumqHIMUwCb2oiVW bYL+plxZjWJEj0GN9X98HYTb79xfhmaoujmoU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Z3x57xwACK8WMQJoOU4X1ksRZqjq/V3A82D/f8kMpVygsVpaVD3esFJta8BizG3XmS C+2Gb+pwubNPnkYghKFmmenxBU1QXAWcfVQW7xkE8SbZLhTtZTiZFDRdVCIeepUI7GiL TkgT4jSt65iExLhucsyEQSATmgE5/JQ+ZJcdM=
MIME-Version: 1.0
Received: by 10.151.16.9 with SMTP id t9mr2007302ybi.25.1276184133519; Thu, 10 Jun 2010 08:35:33 -0700 (PDT)
Received: by 10.151.26.19 with HTTP; Thu, 10 Jun 2010 08:35:32 -0700 (PDT)
In-Reply-To: <AANLkTimCL-O7RIsUlt_zGDfkEEYb9w4_sPh6zxCMBsf0@mail.gmail.com>
References: <AANLkTingSGlJNZ5e_stPd1qU5I4gfbh3rQhqYUmqXvdB@mail.gmail.com> <C833CEB4.6B81%cmortimore@salesforce.com> <AANLkTinVQEPBVzmiHEGgHhzaILL0nRSvZpjIlrVEJwTw@mail.gmail.com> <AANLkTil1j7vl8PU2tgCzlWY0U6KiWPmRKiVOxvsctB00@mail.gmail.com> <AANLkTimCL-O7RIsUlt_zGDfkEEYb9w4_sPh6zxCMBsf0@mail.gmail.com>
Date: Thu, 10 Jun 2010 08:35:32 -0700
Message-ID: <AANLkTin7B9pPgSu3cNlJGkp_gCed-5aPGRZalzXd2Wg8@mail.gmail.com>
From: Andrew Arnott <andrewarnott@gmail.com>
To: Marius Scurtescu <mscurtescu@google.com>
Content-Type: multipart/alternative; boundary="000e0cd5ca24f28aa10488aec564"
Cc: "oauth@ietf.org" <oauth@ietf.org>
Subject: Re: [OAUTH-WG] User-agent flow and pre-registered redirect_uri
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/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, 10 Jun 2010 15:35:39 -0000

Thanks Marius.

I've answered your question below.

On Wed, Jun 9, 2010 at 9:35 AM, Marius Scurtescu <mscurtescu@google.com>wrote:

> > I've always considered an authorization as a tuple of
> > client_id,user,scope,issue_date.  If an authorization has been approved,
> and
> > another request for authorization for a subset of the scope previously
> > issued comes in, the auth server can skip the interactive user
> authorization
> > and just approve the request since nothing new is being issued.
>
> The tuple seems right, except for the issue date, why would you add that?
>

The issue_date enables to scenarios: expiring tokens and token revocation.
Here's how, for each scenario:

Obviously to know if a token has expired you need to know when it was
issued.  Or, you can forget the issue date and just store the expiration
date in the token. I choose to go with an issue date (plus an optional
expected lifetime) because it gives more ability in the future to say "oops,
we had a security weakness in all tokens issued prior to [date], so let's
consider all earlier tokens invalid."  It's harder to say that when all you
have are expiration dates because you don't know how old the token is.  This
is just the way I chose to do it, but I know there are other ways.

Now let's look at how you revoke issued tokens.  One of the nice things
enabled by OAuth 2.0 is that the authorization server and resource server
never have to store tokens if they are appropriate signed by the auth
server.  This is great because (among other things) clients with
little-to-no ability to persistently store tokens may ask for tokens
frequently, and that could bog down an auth server with storing all those
issued tokens.  But how can a user revoke a previously authorized token if
no one but the client knows what the tokens are? (thought question)  My
solution to this is that instead of thinking about revoking *tokens*, the
user revokes *authorizations*.  The user goes through his account on the
authorization server and sees a list of clients and what they are authorized
to do.  Note that this only requires the auth server to store this
authorization tuple -- not the actual issued tokens.  If the user clicks
"revoke" on one of these authorizations, that row is deleted in the
database.  Issued tokens (both refresh and access tokens) have this same
tuple encoded in them.
Now, when a refresh token is used to obtain a new short-lived access token
(and you could do this on every access token use as well if you wanted) the
token is of course signature-validated, but it is also checked that the
authorization tuple has a matching tuple in the auth server's database.  If
it's missing, then that authorization has been revoked and the token is
thereby invalidated.
So why the issue date?  Because suppose the user has authorized a client and
then that client's tokens are compromised (stolen computer perhaps).  The
user will of course revoke authorization for that client.  The user then
gets a new copy of that client (perhaps a new computer) and authorizes it.
Whoops.  Now all those invalidated tokens are valid again because the
authorization tuple exists.  *Except now the issue date on the authorization
on the auth server is newer than in the refresh token on the invalidated
client*.  That's why issue date is such a critical part of an authorization
tuple.  Any token issued prior to the earliest authorization on record at
the auth server represents a revoked authorization, and without an issue
date in the tuple there's no way to recognize that.

At least that's the way I'm seeing it.  I hope that makes sense.