You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Brian Eaton <be...@google.com> on 2008/02/01 21:04:27 UTC

bridge between the container and the gadget server

Reinoud's post about his first steps with Shindig sparked an
interesting discussion I want to pull into a separate thread.  Our
story so far:

Reinoud suggested that the container and the gadget server not need to
share the same data sources, just a few encryption keys.[1]

Kevin agreed. [2]

I said I didn't think not sharing data sources was realistic, because
too much information would need to go in the security token. [3]

Kevin also agreed with that, at which point I got confused.

The main reason I think we'll need to share data sources between the
container and the gadget server is OAuth; there are per user access
tokens that the gadget server needs access to.  That implies the
container and the gadget server are both using the same backend for
their users.  Or am I missing something?

Cheers,
Brian


[1] http://trac.hyves-api.nl/hyves-api/wiki/ShindigStarted
[2] http://mail-archives.apache.org/mod_mbox/incubator-shindig-dev/200802.mbox/browser
[3] http://mail-archives.apache.org/mod_mbox/incubator-shindig-dev/200802.mbox/browser

Re: bridge between the container and the gadget server

Posted by Kevin Brown <et...@google.com>.
On Feb 4, 2008 11:36 AM, Reinoud Elhorst <cl...@claude.nl> wrote:

> On 2/4/08, Kevin Brown <et...@google.com> wrote:
> >
> > Also has nothing to do with this necessarily (although you could require
> > that the GadgetToken be able to return the locked domain, but I think
> this
> > is overkill). I think the best implementation of locked domain for
> shindig
> > is either an md5 or sha1 hash of the gadget url. Creating a collision is
> > virtually impossible because it would require making said collision with
> a
> > fixed prefix (limited to host names the attacker can control) and a
> finite
> > length (~2k for the url parameter). It's a trivial implementation, and
> at
> > the worst case produces exactly the same number of unique sub domains as
> > any
> > other implementation would (by definition; locked domain requires a
> unique
> > domain for every possible gadget).
> >
>
> I think this is important for this discussion. This is because the gadget
> server should only proxy for gadgets that are locked to that domain.


This isn't really a strong requirement, but it can be an implementation
detail. When you validate a token (by calling Gadget*Signer.createToken),
you can trivially validate that the locked domain host matches the url for
the gadget it was signed for.

Re: bridge between the container and the gadget server

Posted by Bruno Bowden <br...@google.com>.
On Feb 7, 2008 12:53 AM, Martin Webb <ma...@gmail.com> wrote:

> On Feb 5, 2008 11:14 PM, Brian Eaton <be...@google.com> wrote:
>
> > On Feb 5, 2008 12:21 PM, Reinoud Elhorst <cl...@claude.nl> wrote:
> > > So I'm wondering what the mystery AUTHENTICATED method should do (it
> > looks
> > > like SHINDIG-35 implements it, still English might be easier to get
> the
> > big
> > > picture), and what the goal of this method is (what extra
> authentication
> > > would it provide)?
> >
> > Glad you asked.  AUTHENTICATED is for implementing the full OAuth
> > protocol flow.  Check out http://oauth.net for the gory details, but
> > here's the basic idea: a user has two accounts on two different sites.
> >  One of them is a gadget container.  The other site (which we'll call
> > the service provider) has some of the user's personal data.  The user
> > would like to display some of their data from the service provider on
> > the gadget container site.
>
>
> Brian,
>
> Myself and a few others for the company (BT.com) I work for are following
> this topic with interest.  I've pointed  them at your  proposal for
> automated  consumer registration.  A couple of questions:
>
> * Will oAuth require a dependency/feature, ala:
>
>  <ModulePrefs title="Hello World!">
>    <Require feature="oauth" />
>  </ModulePrefs>
>
> * Does it mean that *all* widgets on the container will have access to the
> data. ie once the user approves a container host, will the container host
> naively hand anything over to the user. Hopefully, it will be the user
> approving iGoogle+xyz widget, so that iGoogle knows to only hand over data
> to xyz. However, I'm not sure how, under normal oauth operations, a
> consumer
> can be called "iGoogle+xyz".


Because of the same origin policy, the gadget data requests have to go
through the container. So it will effectively be the container that's
granted the OAuth rights. I would expect containers as good policy to only
share OAuth access with the gadgets that have received it. Though
technically the container could share it with other gadgets, this would be
very bad behaviour.

* Need to see more detail about the consumer keys involved, and also the
> mechanism for passing tokens to/from widgets, or perhaps making calls on
> behalf of the widget. Maybe the container never gives the token to the
> widget, but just accepts a "RESTful Command" object which it transforms
> into
> an OAuth REST call. This would guarantee that the token isn't stolen and
> the
> widget (and its provider) can only make calls while running in the
> container?


I'll let other people fill in the details here. As for having the token
stolen, that is a legitimate concern. We should keep it out of urls and in
the header + similar related work to make it harder to leak. The main point
about a token is that it can be revoked, unlike a username / password. So if
the token is revoked or passes it's expiration date, the token becomes
useless at that point, though it could have been used previously.

Regards
> Martin
>
> --
> Internet Related Technologies - http://www.irt.org
>

Re: bridge between the container and the gadget server

Posted by Martin Webb <ma...@gmail.com>.
On Feb 12, 2008 10:06 PM, Brian Eaton <be...@google.com> wrote:

> Awesome.  Would BT be acting as an OAuth consumer or an OAuth service
> provider?
>

As an OAuth service provider in the short term - as a consumer as well in
the longer term


> Interesting proposal.  A few comments on the goals, and some questions
> on how it would work:
>
> goal: manage a much smaller set of consumer keys - only one per container.
> - this seems less important to me.  If you assume that all of your
> users will have several gadgets that use OAuth, you're still talking
> about a most an extra few hundred bytes per user.  If that extra
> storage is really unacceptable there are cryptographic tricks you can
> do to push the storage to the consumer side.  For example, you can set
> the consumer key to be an encrypted version of the consumer secret, so
> the service provider can always derive the necessary consumer secret
> directly from the OAuth messages.  (The STUN RFC proposes this trick,
> I believe.)  There are some security trade-offs here, so I'd be
> inclined to just bite the bullet and pay for the extra storage.


I don't see this as an attempt to reduce the data storage. I see this as a
way to ease the manual management (for those that don't support the
extension) to only have to deal with a small number of consumer keys rather
than thousands.  The data storage will not change in either model:

CONSUMER_KEY (igoogle) -- M:M -- XML URL (xyz) -- 1:M -- ACCESS_TOKEN

vs:

XML URL (xyz) -- 1:1 --  CONSUMER_KEY (represents xyz:igoogle) -- 1:M --
ACCESS_TOKEN

In the first there is a many-to-many relationship which will need a resolver
in the implementation.

question: how should containers decide which gadgets get to use the
> consumer key?


In the pre-gadget world the container is the consumer. My argument is that
in the gadget world the container is still the consumer (else you need to
expose consumer keys and consumer secrets to the gadget - and thus they
leak). So all (or white-listed and not black-listed) gadgets get to use
container's consumer key - but they don't ever see the key or the secret.
The longer term goal is to provide the extensions to actually create
consumer-keys on the fly that represent a gadget on a container - but I
can't see this being supported by all containers just yet...

question: how will this interact with service providers that haven't
> implemented these extensions to the OAuth protocol?  Will they be able
> to associate multiple access tokens associated with a single consumer
> key, or will things break?  How will they convey to their users the
> notion that they aren't just granting authority to a particular
> container, they are granting authority to a gadget?  I'd like to avoid
> a situation where a service provider asks the user a question like "do
> you want to grant Orkut permission to view your data?" if a more
> accurate version of the question would be "do you want to grant gadget
> X permission to view your data?"


An out of band process is needed between each container and each service
provider - but the numbers and combinations should be small enough to not
make this overly onerous?

What I would hate to see is the need for a gadget developer to:
* pre-register their gadget with a provider to obtain a consumer key/secret
* pre-register their gadget with all containers with the consumer key/secret

What happens if months down the line a new container starts up, will 10,000s
of developers needing to pre-register their gadgets on the new container?
How does this help end users who want to use a 3rd party gadget on a
container where the developer hasn't pre-registered?

Regards
Martin

-- 
Internet Related Technologies - http://www.irt.org

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 12, 2008 3:35 AM, Martin Webb <ma...@gmail.com> wrote:
> We've been having lots of discussions at BT.com on oauth and its use within
> gadgets.

Awesome.  Would BT be acting as an OAuth consumer or an OAuth service provider?

> We think that the gadget also needs to provide (either directly or
> indirectly) the details of the request, authorise and access end-points.
> Either as extra gadget configuration or a pointer to an external service
> provider definition (in XML?).

Yeah, this needs to happen, so someone will need to propose an update
to the gadget spec to get the ball rolling.  If you've got an opinion
on how this should look please feel free to draft a proposal.

> ...However, when you describe the format of the consumer challenge it
> doesn't mention the service provider name, we do note however that the
> format of the consumer challenge is up-to the consumer.

I think you've got it exactly.  The format of the consumer challenge
is opaque to the protocol; it's only interpreted by the consumer
software, so it doesn't need to be standardized.  My prototype
implementation used an encrypted, signed, timestamped blob as the
consumer challenge.  Part of the encrypted data was the service
provider name.  This probably needs to be clarified, maybe by
including a reference implementation in the (eventual) spec.

> Having trouble understanding if the optional callback url within the oauth
> spec can actually be of use within a container. Would be interested in your
> thoughts.

Yes, I think it can be useful.  I don't have it implemented in
SHINDIG-35, but a container could use the callback URL to trigger the
process of exchanging the request token for an access token.  User
interaction could be the trigger as well.

<snip proposal for per container keys rather than per container/gadget keys>
> Any thoughts on the above? Particularly whether the consumer should
> represent the container or the gadget type (which is our longer term
> thinking).

Interesting proposal.  A few comments on the goals, and some questions
on how it would work:

goal: identify the gadget xml url that is associated with an access token
- this seems really useful to me, service providers should know what
applications use their services.  Service providers could associate
this information with the consumer key, perhaps, but it would also be
good for containers to forward this to service providers.  Maybe as an
HTTP header or a URL parameter?  I see this as mostly for convenience
rather than security, roughly analogous to the HTTP user-agent header.
 If you want something with security properties the consumer key or
the oauth token are better choices.

goal: be able to invalidate all access tokens associated with a gadget XML url
- this also seems useful, there should be a way for service providers
to respond to abusive gadgets or gadgets with security problems that
make them unsafe to use.  One mechanism would be to search their
consumer key database to find the particular gadgets key and revoke
it, but if we can make it easier to implement that check we should.

goal: manage a much smaller set of consumer keys - only one per container.
- this seems less important to me.  If you assume that all of your
users will have several gadgets that use OAuth, you're still talking
about a most an extra few hundred bytes per user.  If that extra
storage is really unacceptable there are cryptographic tricks you can
do to push the storage to the consumer side.  For example, you can set
the consumer key to be an encrypted version of the consumer secret, so
the service provider can always derive the necessary consumer secret
directly from the OAuth messages.  (The STUN RFC proposes this trick,
I believe.)  There are some security trade-offs here, so I'd be
inclined to just bite the bullet and pay for the extra storage.

question: how should containers decide which gadgets get to use the
consumer key?

question: how will this interact with service providers that haven't
implemented these extensions to the OAuth protocol?  Will they be able
to associate multiple access tokens associated with a single consumer
key, or will things break?  How will they convey to their users the
notion that they aren't just granting authority to a particular
container, they are granting authority to a gadget?  I'd like to avoid
a situation where a service provider asks the user a question like "do
you want to grant Orkut permission to view your data?" if a more
accurate version of the question would be "do you want to grant gadget
X permission to view your data?"

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Martin Webb <ma...@gmail.com>.
Brian,

We've been having lots of discussions at BT.com on oauth and its use within
gadgets.

We believe the Gadget server needs to support a feature (or two) to allow
the gadget to make use of container services to negotiate the request token
and access token. Assuming that the widget has responsibility for
redirecting the user to the service provider for the authorisation. (This
last point maybe debatable - it could be that the container page trips the
authorise step/pop-up - I can't remember how the patch to SHINDIG-35 works -
its applied on another machine).

We think that the gadget also needs to provide (either directly or
indirectly) the details of the request, authorise and access end-points.
Either as extra gadget configuration or a pointer to an external service
provider definition (in XML?).

We are strongly in favour of your extension that allows for consumers (i.e.
containers) to self negotiate a consumer key (by providing a consumer secret
- that passes certain length/content rules) - as described at
http://groups.google.com/group/oauth-extensions/t/bdd87bc7de25867c.  We
don't think this needs to be part of the oauth spec - as some containers may
wish to do this out of band - but for those containers and providers that do
support this then maybe an additional feature (the 2nd one) is required.

Minor comment on your extension:

<quote>
   - the service provider name in the consumer challenge matches the
service provider name sent by the service provider.  (This is done to
prevent a malicious service provider from acting as a MITM by relaying
the challenge to another service provider)
</quote>

...However, when you describe the format of the consumer challenge it
doesn't mention the service provider name, we do note however that the
format of the consumer challenge is up-to the consumer.

Having trouble understanding if the optional callback url within the oauth
spec can actually be of use within a container. Would be interested in your
thoughts.

We think the longer-term goal is for a consumer key to be generated for
every gadget definition added to a particular container (at the point it is
added - either by a gadget developer or user or admin role) - using your
proposed extension to manage the automatic distribution of the consumer key
- by essentially using oauth as intended. However this is likely to generate
10s of thousands of consumer keys (i.e. 10 containers x 1000s of gadget XMLs
requiring oauth), as opposed to the following which we believe is a shorter
term alternative more likey to acceptable to the community...

The gadget triggers the oauth dance, via the container page - the container
page passes the gadget's XML url (or id or whatever), along with service
provider endpoints back to the container (or the container retrieves the
gadget XML url and endpoints from the id - gadget token? - passed by the
container page).

The container looks for an existing consumer key for the service provider
endpoint - if one is not found then the container initiates your extension
to generate a consumer key for the service provide endpoint.  This is only
done once per service provider endpoint.

If the consumer keys exists for the service provider endpoint, then the
oauth dance is performed by the container and the resultant access token
along with the gadget XML url is stored against the consumer key.

Additionally the container passes the gadget XML url to the service provider
as part of the request process - section 6.1.1 of the oauth sepc allows for
this.

This allows service providers to:

* manage a much smaller set of consumer keys - only one per container.
* identify the gadget xml url that is associated with an access token
* invalidate all access tokens associated with a gadget XML url

This means that the consumer key does not need to be invalidated at any
time, unless the container itself has gone bad.

The entity model on the service provider looks somewhat like:

CONSUMER_KEY -- M:M -- XML URL -- 1:M -- ACCESS_TOKEN

This also allows the service provide to optionally get and cache the
gadget's XML independently of the container/gadget server.

Any thoughts on the above? Particularly whether the consumer should
represent the container or the gadget type (which is our longer term
thinking).

Regards
Martin & Jeremy




On Feb 7, 2008 5:53 PM, Brian Eaton <be...@google.com> wrote:

> On Feb 7, 2008 12:53 AM, Martin Webb <ma...@gmail.com> wrote:
> > * Will oAuth require a dependency/feature, ala:
> >
> >   <ModulePrefs title="Hello World!">
> >     <Require feature="oauth" />
> >   </ModulePrefs>
>
> Probably.  I'd love to see proposals for what information should be
> provided in the gadget spec vs provided in the gadgets.io.makeRequest
> call.
>
> If you look at the oauth.patch attachment to
> https://issues.apache.org/jira/browse/SHINDIG-35 you'll see that I've
> hard coded several OAuth values in GadgetStore.java:
> - the oauth URLs
> - the 'nickname' the gadget uses to refer to the URLs
> - the oauth consumer key and consumer secret
>
> Key distribution is an open issue.  When a gadget wants to use OAuth,
> it somehow needs to have a consumer key.  That key should uniquely
> identify a particular container/gadget pair.  How should the container
> figure out what key to use for the gadget?
>
> One option would be automated registration: a protocol for consumers
> to automatically register with service providers.  The container could
> automatically drive this registration process.
>
> Another, manual option, would be for gadget authors and container
> administrators collaborate to get the appropriate keys in place.
>
> A third option would allow gadget authors to automatically get their
> OAuth gadget working in containers, without container administrator
> intervention.  When a gadget author wants to enable OAuth for their
> gadget in a particular container, they would go to that container and
> add the gadget.  The container would detect that an OAuth consumer key
> was necessary, and would prompt the person adding the gadget to
> provide the right keys.
>
> This somewhat messy key distribution problem could be simplified by
> having containers register a single consumer key and secret with
> service providers, so that instead of one consumer key per gadget you
> would have only one per container.  Containers would then need to
> somehow manage the process of users granting approval to individual
> gadgets to use the consumer key and secret.
>
> I don't like that last solution.  It doesn't really simplify the key
> management problem, it just moves it around.
>
> > * Does it mean that *all* widgets on the container will have access to
> the
> > data. ie once the user approves a container host, will the container
> host
> > naively hand anything over to the user. Hopefully, it will be the user
> > approving iGoogle+xyz widget, so that iGoogle knows to only hand over
> data
> > to xyz. However, I'm not sure how, under normal oauth operations, a
> consumer
> > can be called "iGoogle+xyz".
>
> Different people have looked at this from different perspectives, but
> I agree with you that users should approve "iGoogle+xyz" and not just
> "iGoogle."  The container should hold keys on behalf of a particular
> gadget, and should never share those keys with other gadgets.
>
> This should work fine with OAuth service providers.  They don't need
> to know the difference between a normal web application acting as a
> consumer and a container/gadget pair acting as a consumer.  OAuth
> service providers identify consumers with a consumer key, an opaque
> string.  That opaque string could represent a desktop application, a
> web based app, or a container/gadget pair.
>
> > * Need to see more detail about the consumer keys involved, and also the
> > mechanism for passing tokens to/from widgets, or perhaps making calls on
> > behalf of the widget. Maybe the container never gives the token to the
> > widget, but just accepts a "RESTful Command" object which it transforms
> into
> > an OAuth REST call. This would guarantee that the token isn't stolen and
> the
> > widget (and its provider) can only make calls while running in the
> > container?
>
> Yes, exactly.  The long lived secrets should never leave the
> container.  It's too easy for browsers to leak secrets.  Instead the
> gadget will receive a 'gadget security token' that it can use to
> request that the container make OAuth calls on behalf of the gadget.
>
> Cheers,
> Brian
>



-- 
Internet Related Technologies - http://www.irt.org

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 7, 2008 12:53 AM, Martin Webb <ma...@gmail.com> wrote:
> * Will oAuth require a dependency/feature, ala:
>
>   <ModulePrefs title="Hello World!">
>     <Require feature="oauth" />
>   </ModulePrefs>

Probably.  I'd love to see proposals for what information should be
provided in the gadget spec vs provided in the gadgets.io.makeRequest
call.

If you look at the oauth.patch attachment to
https://issues.apache.org/jira/browse/SHINDIG-35 you'll see that I've
hard coded several OAuth values in GadgetStore.java:
- the oauth URLs
- the 'nickname' the gadget uses to refer to the URLs
- the oauth consumer key and consumer secret

Key distribution is an open issue.  When a gadget wants to use OAuth,
it somehow needs to have a consumer key.  That key should uniquely
identify a particular container/gadget pair.  How should the container
figure out what key to use for the gadget?

One option would be automated registration: a protocol for consumers
to automatically register with service providers.  The container could
automatically drive this registration process.

Another, manual option, would be for gadget authors and container
administrators collaborate to get the appropriate keys in place.

A third option would allow gadget authors to automatically get their
OAuth gadget working in containers, without container administrator
intervention.  When a gadget author wants to enable OAuth for their
gadget in a particular container, they would go to that container and
add the gadget.  The container would detect that an OAuth consumer key
was necessary, and would prompt the person adding the gadget to
provide the right keys.

This somewhat messy key distribution problem could be simplified by
having containers register a single consumer key and secret with
service providers, so that instead of one consumer key per gadget you
would have only one per container.  Containers would then need to
somehow manage the process of users granting approval to individual
gadgets to use the consumer key and secret.

I don't like that last solution.  It doesn't really simplify the key
management problem, it just moves it around.

> * Does it mean that *all* widgets on the container will have access to the
> data. ie once the user approves a container host, will the container host
> naively hand anything over to the user. Hopefully, it will be the user
> approving iGoogle+xyz widget, so that iGoogle knows to only hand over data
> to xyz. However, I'm not sure how, under normal oauth operations, a consumer
> can be called "iGoogle+xyz".

Different people have looked at this from different perspectives, but
I agree with you that users should approve "iGoogle+xyz" and not just
"iGoogle."  The container should hold keys on behalf of a particular
gadget, and should never share those keys with other gadgets.

This should work fine with OAuth service providers.  They don't need
to know the difference between a normal web application acting as a
consumer and a container/gadget pair acting as a consumer.  OAuth
service providers identify consumers with a consumer key, an opaque
string.  That opaque string could represent a desktop application, a
web based app, or a container/gadget pair.

> * Need to see more detail about the consumer keys involved, and also the
> mechanism for passing tokens to/from widgets, or perhaps making calls on
> behalf of the widget. Maybe the container never gives the token to the
> widget, but just accepts a "RESTful Command" object which it transforms into
> an OAuth REST call. This would guarantee that the token isn't stolen and the
> widget (and its provider) can only make calls while running in the
> container?

Yes, exactly.  The long lived secrets should never leave the
container.  It's too easy for browsers to leak secrets.  Instead the
gadget will receive a 'gadget security token' that it can use to
request that the container make OAuth calls on behalf of the gadget.

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Martin Webb <ma...@gmail.com>.
On Feb 5, 2008 11:14 PM, Brian Eaton <be...@google.com> wrote:

> On Feb 5, 2008 12:21 PM, Reinoud Elhorst <cl...@claude.nl> wrote:
> > So I'm wondering what the mystery AUTHENTICATED method should do (it
> looks
> > like SHINDIG-35 implements it, still English might be easier to get the
> big
> > picture), and what the goal of this method is (what extra authentication
> > would it provide)?
>
> Glad you asked.  AUTHENTICATED is for implementing the full OAuth
> protocol flow.  Check out http://oauth.net for the gory details, but
> here's the basic idea: a user has two accounts on two different sites.
>  One of them is a gadget container.  The other site (which we'll call
> the service provider) has some of the user's personal data.  The user
> would like to display some of their data from the service provider on
> the gadget container site.


Brian,

Myself and a few others for the company (BT.com) I work for are following
this topic with interest.  I've pointed  them at your  proposal for
automated  consumer registration.  A couple of questions:

* Will oAuth require a dependency/feature, ala:

  <ModulePrefs title="Hello World!">
    <Require feature="oauth" />
  </ModulePrefs>

* Does it mean that *all* widgets on the container will have access to the
data. ie once the user approves a container host, will the container host
naively hand anything over to the user. Hopefully, it will be the user
approving iGoogle+xyz widget, so that iGoogle knows to only hand over data
to xyz. However, I'm not sure how, under normal oauth operations, a consumer
can be called "iGoogle+xyz".

* Need to see more detail about the consumer keys involved, and also the
mechanism for passing tokens to/from widgets, or perhaps making calls on
behalf of the widget. Maybe the container never gives the token to the
widget, but just accepts a "RESTful Command" object which it transforms into
an OAuth REST call. This would guarantee that the token isn't stolen and the
widget (and its provider) can only make calls while running in the
container?

Regards
Martin

-- 
Internet Related Technologies - http://www.irt.org

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 6, 2008 4:37 AM, Reinoud Elhorst <cl...@claude.nl> wrote:
> Now, I assume this will only work if there is some information on the
> gadget-server on the "request URLs" for
> http://www.example.com/something(since no discovery is in oAuth at the
> moment). In addition, it should have
> a consumer id (or be able to obtain one).

What I'd like to see: service providers support automatic registration
of containers in gadgets for consumer keys.  I've written up a
proposal for how automated consumer registration could work:
http://groups.google.com/group/oauth-extensions/t/bdd87bc7de25867c.
Either the container or the gadget server would provide the consumer
identification URL.

What I think will happen: manual registration of consumer keys on both
the service provider and container side, until hopefully this becomes
popular enough that automatic registration is needed.

> This also seems to be the
> only part where Shindig needs any sort of persistent
> storage (except the caching), and possibly shared storage (to be able to cancel
> accestokens, I guess). I think that initially I'd be happy to have
> only a minimal implementation

I think there's more than one way to make this work, and I agree that
signed fetch is more important in the short term.  I'd like to see two
options for Shindig, one where the container and the gadget server
share backend data stores, another where they don't.  For the case
where they do share data stores, I hope my patch to SHINDIG-35 serves
as a starting point for the interface.  For the case where there is no
shared storage, maybe an IFPC implementation would work?

For example, maybe something like this for signed fetch:
- gadgets.io.makeRequest intercepts requests with AUTHORIZATION:
SIGNED and performs an IFPC call back to the container with the
makeRequest data.
- the container HTML forwards the request to the container HTTP server
with XHR, which then signs the request and returns the signed version.
- the container HTML performs an IFPC back into the gadget.
gadgets.io.makeRequest then forwards the signed request to the gadget
server proxy, which fetches the data.

An IFPC based implementation of full OAuth would be a pain, but it
could probably be done.  Maybe a starting point for Shindig would be
to support two scenarios:

shared storage: implement a java interface to your app data stores,
and you get both signed fetch and OAuth.
no shared storage: implement signing in your container, and Shindig
will use IFPC to do the signing.  No support for full OAuth.

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Reinoud Elhorst <cl...@claude.nl>.
OK, I'm starting to understand.....

Is there any idea yet on how this should work. Let's say that I do a
gadgets.io.makeRquest("http://www.example.com/something",callback, {
gadgets.io.RequestParameters.AUTHENTICATION :
gadgets.io.AuthorizationType.AUTHENTICATED})

Now, I assume this will only work if there is some information on the
gadget-server on the "request URLs" for
http://www.example.com/something(since no discovery is in oAuth at the
moment). In addition, it should have
a consumer id (or be able to obtain one).

So if this is the first call for this user, the gadget server requests a
requesttoken. Then somehow (popup, redirect, really an implementation
choice), the user is led to the "User Authentication URL". After
logging
in and giving
approval, the gadget server is notified, and requests an accesstoken.
It will then use the accesstoken to do the original request.

Obviously once an accesstoken had been obtained in some previous request
(possibly in a previous session), that one can be used directly.


You know I'm a big fan of oAuth and open standards, and I see the problem
that it's trying to solve, at the moment however it doesn't seem like the
place I want to start implementing Shindig in Hyves :). I'm wondering how
many gadgets will use this (initially at least). This also seems to be the
only part where Shindig needs any sort of persistent
storage (except the caching), and possibly shared storage (to be able to cancel
accestokens, I guess). I think that initially I'd be happy to have
only a minimal implementation
(I guess a very simple database/memcached would
do), and only start worrying about managing it if a lot of gadgets
start using it.

On 2/6/08, Brian Eaton <be...@google.com> wrote:
>
> On Feb 5, 2008 3:42 PM, Reinoud Elhorst <cl...@claude.nl> wrote:
> > Would this be for gadgets authenticating towards their "home sites" (so
> a
> > gadget of lastfm wanting to show data the user previously entered on
> > lastfm), or connecting to third party API's (let's say a fictional Slide
> > gadget wanting to retrieve private photo's from Flickr)
>
> It depends how many different identity silos are involved.  If a
> user's entire interaction with the 'home site' is through a single
> SNS, you don't really need OAuth.  Signed fetch is enough for the home
> site to keep track of the user.  If there are multiple SNS and you are
> trying to have all connect to the same account on the home site, full
> OAuth is useful.  If the user has a separate login and password on the
> SNS vs the home site, full OAuth is useful.
>
> I haven't played with lastfm, but the Slide/Flickr use case sounds
> like OAuth to me.
>
> Cheers,
> Brian
>

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 5, 2008 3:42 PM, Reinoud Elhorst <cl...@claude.nl> wrote:
> Would this be for gadgets authenticating towards their "home sites" (so a
> gadget of lastfm wanting to show data the user previously entered on
> lastfm), or connecting to third party API's (let's say a fictional Slide
> gadget wanting to retrieve private photo's from Flickr)

It depends how many different identity silos are involved.  If a
user's entire interaction with the 'home site' is through a single
SNS, you don't really need OAuth.  Signed fetch is enough for the home
site to keep track of the user.  If there are multiple SNS and you are
trying to have all connect to the same account on the home site, full
OAuth is useful.  If the user has a separate login and password on the
SNS vs the home site, full OAuth is useful.

I haven't played with lastfm, but the Slide/Flickr use case sounds
like OAuth to me.

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Reinoud Elhorst <cl...@claude.nl>.
Ah - suddenly I'm getting why you were talking about access tokens before :)

Would this be for gadgets authenticating towards their "home sites" (so a
gadget of lastfm wanting to show data the user previously entered on
lastfm), or connecting to third party API's (let's say a fictional Slide
gadget wanting to retrieve private photo's from Flickr)?



On 2/6/08, Brian Eaton <be...@google.com> wrote:
>
> On Feb 5, 2008 12:21 PM, Reinoud Elhorst <cl...@claude.nl> wrote:
> > So I'm wondering what the mystery AUTHENTICATED method should do (it
> looks
> > like SHINDIG-35 implements it, still English might be easier to get the
> big
> > picture), and what the goal of this method is (what extra authentication
> > would it provide)?
>
> Glad you asked.  AUTHENTICATED is for implementing the full OAuth
> protocol flow.  Check out http://oauth.net for the gory details, but
> here's the basic idea: a user has two accounts on two different sites.
> One of them is a gadget container.  The other site (which we'll call
> the service provider) has some of the user's personal data.  The user
> would like to display some of their data from the service provider on
> the gadget container site.
>
> The traditional way to do this is for the container site to ask for
> the username and password for the service provider site, and then
> screen scrape the user's data.  This is not a good model, and we'd
> like to discourage opensocial gadgets from following this pattern.
> Instead, they can use OAuth to get the user's permission to view their
> data, without needing their password.  It works like this:
>
> - the container notifies the service provider that they are going to
> request permission to view a user's data.
> - the container then redirects the user to an approval page on the
> service provider side.
> - the user gives their approval to view the data
> - the container then receives a secret value that they can use to pull
> the data from the service provider's site.
>
> Users don't need to give out their passwords to everyone who asks, and
> they keep control over who gets to see their data.  Service providers
> can allow users to grant temporary access to their data, or revoke
> access if they decide they don't trust a container any longer.
>
> Cheers,
> Brian
>

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 5, 2008 12:21 PM, Reinoud Elhorst <cl...@claude.nl> wrote:
> So I'm wondering what the mystery AUTHENTICATED method should do (it looks
> like SHINDIG-35 implements it, still English might be easier to get the big
> picture), and what the goal of this method is (what extra authentication
> would it provide)?

Glad you asked.  AUTHENTICATED is for implementing the full OAuth
protocol flow.  Check out http://oauth.net for the gory details, but
here's the basic idea: a user has two accounts on two different sites.
 One of them is a gadget container.  The other site (which we'll call
the service provider) has some of the user's personal data.  The user
would like to display some of their data from the service provider on
the gadget container site.

The traditional way to do this is for the container site to ask for
the username and password for the service provider site, and then
screen scrape the user's data.  This is not a good model, and we'd
like to discourage opensocial gadgets from following this pattern.
Instead, they can use OAuth to get the user's permission to view their
data, without needing their password.  It works like this:

- the container notifies the service provider that they are going to
request permission to view a user's data.
- the container then redirects the user to an approval page on the
service provider side.
- the user gives their approval to view the data
- the container then receives a secret value that they can use to pull
the data from the service provider's site.

Users don't need to give out their passwords to everyone who asks, and
they keep control over who gets to see their data.  Service providers
can allow users to grant temporary access to their data, or revoke
access if they decide they don't trust a container any longer.

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Reinoud Elhorst <cl...@claude.nl>.
On 2/5/08, Brian Eaton <be...@google.com> wrote:
>
> And sliding back to how this got started... how would you feel about
> implementing the UserStore and GadgetStore interfaces[1] to talk to
> your container's persistent storage?  There are some gadget features,
> like OAuth, that are tricky to implement without some kind of
> persistent storage shared by the container and the gadget server.  I'm
> definitely interested in approaches that avoid the need for the shared
> persistent storage, but I'd also like to keep things as simple as
> possible.  Are UserStore and GadgetServer simple enough?


I was still not convinced that this is needed. Then I  looked through your
patch, and dug a little deeper into the documentation. Now I'm just confused
:)

Only kust now I realised that 3 authentication-methods are available: NONE,
SIGNED and AUTHENTICATED [1]. It seems that up until
now, I only considered the first two. NONE is clear enough, SIGNED is
the oAuth signing I had in mind all along (I
believe it's described at [2], and it seems to do exactly what is described
at [3]).

So I'm wondering what the mystery AUTHENTICATED method should do (it looks
like SHINDIG-35 implements it, still English might be easier to get the big
picture), and what the goal of this method is (what extra authentication
would it provide)?

[1]
http://code.google.com/apis/gadgets/docs/reference/gadgets.io.AuthorizationType.html
[2]
http://groups.google.com/group/opensocial/web/validating-signed-requests-from-orkut
[3] http://code.google.com/apis/opensocial/docs/0.7/spec.html#remote

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 4, 2008 11:36 AM, Reinoud Elhorst <cl...@claude.nl> wrote:
> I think this is important for this discussion. This is because the gadget
> server should only proxy for gadgets that are locked to that domain.
> So when receiving a proxy
> request, the gadget server should be able to authenticate that the
> request came from a gadget on that domain.

Out of curiosity, what attack are you trying to prevent by having the
gadget server only serve proxy requests for gadgets the container
rendered?  Is it just the open proxy issue that you're concerned
about, or something more?

And sliding back to how this got started... how would you feel about
implementing the UserStore and GadgetStore interfaces[1] to talk to
your container's persistent storage?  There are some gadget features,
like OAuth, that are tricky to implement without some kind of
persistent storage shared by the container and the gadget server.  I'm
definitely interested in approaches that avoid the need for the shared
persistent storage, but I'd also like to keep things as simple as
possible.  Are UserStore and GadgetServer simple enough?

[1] see the oauth.patch file attached to
https://issues.apache.org/jira/browse/SHINDIG-35

Re: bridge between the container and the gadget server

Posted by Reinoud Elhorst <cl...@claude.nl>.
On 2/4/08, Kevin Brown <et...@google.com> wrote:
>
> Also has nothing to do with this necessarily (although you could require
> that the GadgetToken be able to return the locked domain, but I think this
> is overkill). I think the best implementation of locked domain for shindig
> is either an md5 or sha1 hash of the gadget url. Creating a collision is
> virtually impossible because it would require making said collision with a
> fixed prefix (limited to host names the attacker can control) and a finite
> length (~2k for the url parameter). It's a trivial implementation, and at
> the worst case produces exactly the same number of unique sub domains as
> any
> other implementation would (by definition; locked domain requires a unique
> domain for every possible gadget).
>

I think this is important for this discussion. This is because the gadget
server should only proxy for gadgets that are locked to that domain.
So when receiving a proxy
request, the gadget server should be able to authenticate that the
request came from a gadget on that domain.

I do agree with you that some sort of hash of the gadget url will do just
fine, as long as it' s large enough

Re: bridge between the container and the gadget server

Posted by Kevin Brown <et...@google.com>.
On Feb 4, 2008 10:14 AM, Brian Eaton <be...@google.com> wrote:

> On Feb 4, 2008 9:59 AM, Kevin Brown <et...@google.com> wrote:
> > This puts too much burdeon on potential consumers of Shindig to have to
> > place app data server logic into the gadgets server. We've been
> > intentionally avoiding this from the beginning. The GadgetServer
> shouldn't
> > be required to know anything about the app data server. All
> communication
> > with the app data server can happen over the proxy (if on a different
> host
> > name), directly within the gadget via XHR if on the same host, or over
> IFPC
> > (in the container mediated model). The security token is an opaque
> string
> > that is simply passed on in this case. The only time the gadget server
> > actually does anything with the security token is when it is being used
> for
> > operations like locking down the open proxy.
>
> You've lost me.  Can you give me some details on how this would work,
> for either the IFPC or the proxy model?
>
> In particular:
> - how would setprefs be implemented?


Up to the container; this is already container mediated (doesn't really have
any impact on this discussion).

- how would phone home be implemented?


This probably is best served in the proxy, which is why I suggested starting
from scratch with a new mechanism for this. The security token /
GadgetSigner was devised long before we had any concept of signed or
authenticated requests as a part of the gadgets API. This doesn't actually
require knowledge of the app data server, though, it only requires knowledge
on how to decode the token.

- how would locked domains be implemented?


Also has nothing to do with this necessarily (although you could require
that the GadgetToken be able to return the locked domain, but I think this
is overkill). I think the best implementation of locked domain for shindig
is either an md5 or sha1 hash of the gadget url. Creating a collision is
virtually impossible because it would require making said collision with a
fixed prefix (limited to host names the attacker can control) and a finite
length (~2k for the url parameter). It's a trivial implementation, and at
the worst case produces exactly the same number of unique sub domains as any
other implementation would (by definition; locked domain requires a unique
domain for every possible gadget).

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 4, 2008 9:59 AM, Kevin Brown <et...@google.com> wrote:
> This puts too much burdeon on potential consumers of Shindig to have to
> place app data server logic into the gadgets server. We've been
> intentionally avoiding this from the beginning. The GadgetServer shouldn't
> be required to know anything about the app data server. All communication
> with the app data server can happen over the proxy (if on a different host
> name), directly within the gadget via XHR if on the same host, or over IFPC
> (in the container mediated model). The security token is an opaque string
> that is simply passed on in this case. The only time the gadget server
> actually does anything with the security token is when it is being used for
> operations like locking down the open proxy.

You've lost me.  Can you give me some details on how this would work,
for either the IFPC or the proxy model?

In particular:
- how would setprefs be implemented?
- how would phone home be implemented?
- how would locked domains be implemented?

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Kevin Brown <et...@google.com>.
On Feb 4, 2008 9:46 AM, Brian Eaton <be...@google.com> wrote:

> On Feb 4, 2008 4:01 AM, Reinoud Elhorst <cl...@claude.nl> wrote:
> > How then would the secure phone home be implemented? To sign stuff like
> the
> > ownerid, the gadget server needs to have reliable information on the
> > ownerid. I believe it can only have that by either parsing the st, or
> asking
> > the container-backend for the viewer/owner/appid, passing on the st?
>
> I lean towards the latter.  Someone trying to glue together a
> container and the gadget server configures/writes code for the gadget
> server to talk to their app data server.  That includes operations
> like verifying the security token.


This puts too much burdeon on potential consumers of Shindig to have to
place app data server logic into the gadgets server. We've been
intentionally avoiding this from the beginning. The GadgetServer shouldn't
be required to know anything about the app data server. All communication
with the app data server can happen over the proxy (if on a different host
name), directly within the gadget via XHR if on the same host, or over IFPC
(in the container mediated model). The security token is an opaque string
that is simply passed on in this case. The only time the gadget server
actually does anything with the security token is when it is being used for
operations like locking down the open proxy.

Re: bridge between the container and the gadget server

Posted by Brian Eaton <be...@google.com>.
On Feb 4, 2008 4:01 AM, Reinoud Elhorst <cl...@claude.nl> wrote:
> How then would the secure phone home be implemented? To sign stuff like the
> ownerid, the gadget server needs to have reliable information on the
> ownerid. I believe it can only have that by either parsing the st, or asking
> the container-backend for the viewer/owner/appid, passing on the st?

I lean towards the latter.  Someone trying to glue together a
container and the gadget server configures/writes code for the gadget
server to talk to their app data server.  That includes operations
like verifying the security token.

> (I understand that how the secure phone home is being done is an
> implementation detail, still I'm wondering on what the idea is on how to do
> that in Shindig)

I think it should be implemented in a manner similar to the patch
attached to this bug:

https://issues.apache.org/jira/browse/SHINDIG-35

Cheers,
Brian

Re: bridge between the container and the gadget server

Posted by Reinoud Elhorst <cl...@claude.nl>.
If the "st" is not used for the secure phone home, it is indeed completely
up to the container what the token should look like. I do like that idea!

(but...)

How then would the secure phone home be implemented? To sign stuff like the
ownerid, the gadget server needs to have reliable information on the
ownerid. I believe it can only have that by either parsing the st, or asking
the container-backend for the viewer/owner/appid, passing on the st?

(I understand that how the secure phone home is being done is an
implementation detail, still I'm wondering on what the idea is on how to do
that in Shindig)

On 2/3/08, Kevin Brown <et...@google.com> wrote:
>
> The token passed in st doesn't necessarily have to be the same token used
> for OAuth or secure phone home. It's mostly intended to pass secure
> information from the container into the gadget so that the gadget can pass
> it up to back ends as appropriate. It's mostly intended as an alternative
> to
> container mediated access.
>
> The ideas can certainly be applied to various other security solutions,
> such
> as those required by open social, but it is very much an implementation
> detail at this point. I'd be weary of trying to overload the single
> concept
> too much, because it'll yield an unwieldy interface and make deploying
> shindig that much harder.
>
> On Feb 3, 2008 9:22 AM, Reinoud Elhorst <cl...@claude.nl> wrote:
>
> > On 2/1/08, Kevin Brown <et...@google.com> wrote:
> > >
> > > On Feb 1, 2008 12:04 PM, Brian Eaton <be...@google.com> wrote:
> > >
> > > > Reinoud's post about his first steps with Shindig sparked an
> > > > interesting discussion I want to pull into a separate thread.  Our
> > > > story so far:
> > > >
> > > > Reinoud suggested that the container and the gadget server not need
> to
> > > > share the same data sources, just a few encryption keys.[1]
> > > >
> > > > Kevin agreed. [2]
> > > >
> > > > I said I didn't think not sharing data sources was realistic,
> because
> > > > too much information would need to go in the security token. [3]
> > > >
> > > > Kevin also agreed with that, at which point I got confused.
> > > >
> > > > The main reason I think we'll need to share data sources between the
> > > > container and the gadget server is OAuth; there are per user access
> > > > tokens that the gadget server needs access to.  That implies the
> > > > container and the gadget server are both using the same backend for
> > > > their users.  Or am I missing something?
> >
> >
> > I assume you're talking about the current "phone home" functionality,
> not
> > the SPI API? For the latter, I haven't though that one completely
> through
> > yet, pehaps little use in that until we have a spec.
> >
> > As far as I can tell from the documentation [1], the secure phone home
> > doesn't use any access tokens. All it does
> > is use the shared secret (or public/private key) to sign the viewerid
> (if
> > available to the gadget), ownerid and application URL.
> >
> >
> > Every container could have it's own back end that understands the
> security
> > > token. There's no need to pass anything other than the most basic data
> > > required to authenticate. Example:
> > >
> > > Container generates token that contains: current viewer, owner of the
> > > current page,  and the url of the gadget that was rendered. It gets
> > passed
> > > to the iframe as #st=<base 64 encoded token>
> > >
> > > opensocial feature uses gadgets.io.makeRequest and forwards the token
> > > itself
> > > to the target back end (alternatively, if it's on the same host, it
> > could
> > > simply make a normal XHR).
> > >
> > > App data back end decrypts the token and returns data for whatever the
> > > current request requires (friend graph, app data, whatever).
> > >
> > > The *gadget server* doesn't care about authentication (other than
> > > validation
> > > of tokens in some special cases, like signed proxy requests). It's the
> > > *app
> > > data* servers that actually need to know about this. It's possible for
> > the
> > > gadget server to also be an app data server, of course, but I think
> that
> > > this is impractical for real websites.
> >
> >
> >
> > I agree with Kevin here, although I don't think we can step over the
> > second usage of the taken so easily.
> > I think Kevin made clear that any call that is forwarded to the
> > data-API-backend of the container, is not an
> > issue. The gadget server does nothing here but pass on, and the API
> > backend obviously has shared data backend (and probably shared code)
> > with the container site.
> > The second usage is the "secure phone home". Here the gadget server
> needs
> > to
> > 1) Check whether the st is valid (e.g
> > . check the signature) - this would require a shared secret
> > 2) Extract the ownerid and gadget-url from the st (I don't think these
> > values need even be encrypted; both are always known to the gadget)
> > 3) Check if the gadget has access to viewer data, in that case extract
> the
> > viewer_id from the token
> > 4) Add ownerid, gadget url and, if visible, viewerid to
> > the url-to-be-called, add a timestamp & nonce,
> > calculate the oauth_secret (either RSA or HMAC) and add that
> >
> > Now, from the list above, I think only step 3
> > might need some more thought: how can the gadget server know that the
> > viewer information is visible. I suggested before to use a second
> > token for this, and I still believe this can be done securely.
> > Obviously this second token would need to be checked for
> > validity
> > by the gadget server as well, so for this possibly a second shared
> > secret is needed.
> >
> > Reinoud
> >
> > [1] http://code.google.com/apis/opensocial/docs/0.7/spec.html#remote
> >
>

Re: bridge between the container and the gadget server

Posted by Kevin Brown <et...@google.com>.
The token passed in st doesn't necessarily have to be the same token used
for OAuth or secure phone home. It's mostly intended to pass secure
information from the container into the gadget so that the gadget can pass
it up to back ends as appropriate. It's mostly intended as an alternative to
container mediated access.

The ideas can certainly be applied to various other security solutions, such
as those required by open social, but it is very much an implementation
detail at this point. I'd be weary of trying to overload the single concept
too much, because it'll yield an unwieldy interface and make deploying
shindig that much harder.

On Feb 3, 2008 9:22 AM, Reinoud Elhorst <cl...@claude.nl> wrote:

> On 2/1/08, Kevin Brown <et...@google.com> wrote:
> >
> > On Feb 1, 2008 12:04 PM, Brian Eaton <be...@google.com> wrote:
> >
> > > Reinoud's post about his first steps with Shindig sparked an
> > > interesting discussion I want to pull into a separate thread.  Our
> > > story so far:
> > >
> > > Reinoud suggested that the container and the gadget server not need to
> > > share the same data sources, just a few encryption keys.[1]
> > >
> > > Kevin agreed. [2]
> > >
> > > I said I didn't think not sharing data sources was realistic, because
> > > too much information would need to go in the security token. [3]
> > >
> > > Kevin also agreed with that, at which point I got confused.
> > >
> > > The main reason I think we'll need to share data sources between the
> > > container and the gadget server is OAuth; there are per user access
> > > tokens that the gadget server needs access to.  That implies the
> > > container and the gadget server are both using the same backend for
> > > their users.  Or am I missing something?
>
>
> I assume you're talking about the current "phone home" functionality, not
> the SPI API? For the latter, I haven't though that one completely through
> yet, pehaps little use in that until we have a spec.
>
> As far as I can tell from the documentation [1], the secure phone home
> doesn't use any access tokens. All it does
> is use the shared secret (or public/private key) to sign the viewerid (if
> available to the gadget), ownerid and application URL.
>
>
> Every container could have it's own back end that understands the security
> > token. There's no need to pass anything other than the most basic data
> > required to authenticate. Example:
> >
> > Container generates token that contains: current viewer, owner of the
> > current page,  and the url of the gadget that was rendered. It gets
> passed
> > to the iframe as #st=<base 64 encoded token>
> >
> > opensocial feature uses gadgets.io.makeRequest and forwards the token
> > itself
> > to the target back end (alternatively, if it's on the same host, it
> could
> > simply make a normal XHR).
> >
> > App data back end decrypts the token and returns data for whatever the
> > current request requires (friend graph, app data, whatever).
> >
> > The *gadget server* doesn't care about authentication (other than
> > validation
> > of tokens in some special cases, like signed proxy requests). It's the
> > *app
> > data* servers that actually need to know about this. It's possible for
> the
> > gadget server to also be an app data server, of course, but I think that
> > this is impractical for real websites.
>
>
>
> I agree with Kevin here, although I don't think we can step over the
> second usage of the taken so easily.
> I think Kevin made clear that any call that is forwarded to the
> data-API-backend of the container, is not an
> issue. The gadget server does nothing here but pass on, and the API
> backend obviously has shared data backend (and probably shared code)
> with the container site.
> The second usage is the "secure phone home". Here the gadget server needs
> to
> 1) Check whether the st is valid (e.g
> . check the signature) - this would require a shared secret
> 2) Extract the ownerid and gadget-url from the st (I don't think these
> values need even be encrypted; both are always known to the gadget)
> 3) Check if the gadget has access to viewer data, in that case extract the
> viewer_id from the token
> 4) Add ownerid, gadget url and, if visible, viewerid to
> the url-to-be-called, add a timestamp & nonce,
> calculate the oauth_secret (either RSA or HMAC) and add that
>
> Now, from the list above, I think only step 3
> might need some more thought: how can the gadget server know that the
> viewer information is visible. I suggested before to use a second
> token for this, and I still believe this can be done securely.
> Obviously this second token would need to be checked for
> validity
> by the gadget server as well, so for this possibly a second shared
> secret is needed.
>
> Reinoud
>
> [1] http://code.google.com/apis/opensocial/docs/0.7/spec.html#remote
>

Re: bridge between the container and the gadget server

Posted by Reinoud Elhorst <cl...@claude.nl>.
On 2/1/08, Kevin Brown <et...@google.com> wrote:
>
> On Feb 1, 2008 12:04 PM, Brian Eaton <be...@google.com> wrote:
>
> > Reinoud's post about his first steps with Shindig sparked an
> > interesting discussion I want to pull into a separate thread.  Our
> > story so far:
> >
> > Reinoud suggested that the container and the gadget server not need to
> > share the same data sources, just a few encryption keys.[1]
> >
> > Kevin agreed. [2]
> >
> > I said I didn't think not sharing data sources was realistic, because
> > too much information would need to go in the security token. [3]
> >
> > Kevin also agreed with that, at which point I got confused.
> >
> > The main reason I think we'll need to share data sources between the
> > container and the gadget server is OAuth; there are per user access
> > tokens that the gadget server needs access to.  That implies the
> > container and the gadget server are both using the same backend for
> > their users.  Or am I missing something?


I assume you're talking about the current "phone home" functionality, not
the SPI API? For the latter, I haven't though that one completely through
yet, pehaps little use in that until we have a spec.

As far as I can tell from the documentation [1], the secure phone home
doesn't use any access tokens. All it does
is use the shared secret (or public/private key) to sign the viewerid (if
available to the gadget), ownerid and application URL.


Every container could have it's own back end that understands the security
> token. There's no need to pass anything other than the most basic data
> required to authenticate. Example:
>
> Container generates token that contains: current viewer, owner of the
> current page,  and the url of the gadget that was rendered. It gets passed
> to the iframe as #st=<base 64 encoded token>
>
> opensocial feature uses gadgets.io.makeRequest and forwards the token
> itself
> to the target back end (alternatively, if it's on the same host, it could
> simply make a normal XHR).
>
> App data back end decrypts the token and returns data for whatever the
> current request requires (friend graph, app data, whatever).
>
> The *gadget server* doesn't care about authentication (other than
> validation
> of tokens in some special cases, like signed proxy requests). It's the
> *app
> data* servers that actually need to know about this. It's possible for the
> gadget server to also be an app data server, of course, but I think that
> this is impractical for real websites.



I agree with Kevin here, although I don't think we can step over the
second usage of the taken so easily.
I think Kevin made clear that any call that is forwarded to the
data-API-backend of the container, is not an
issue. The gadget server does nothing here but pass on, and the API
backend obviously has shared data backend (and probably shared code)
with the container site.
The second usage is the "secure phone home". Here the gadget server needs to
1) Check whether the st is valid (e.g
. check the signature) - this would require a shared secret
2) Extract the ownerid and gadget-url from the st (I don't think these
values need even be encrypted; both are always known to the gadget)
3) Check if the gadget has access to viewer data, in that case extract the
viewer_id from the token
4) Add ownerid, gadget url and, if visible, viewerid to
the url-to-be-called, add a timestamp & nonce,
calculate the oauth_secret (either RSA or HMAC) and add that

Now, from the list above, I think only step 3
might need some more thought: how can the gadget server know that the
viewer information is visible. I suggested before to use a second
token for this, and I still believe this can be done securely.
Obviously this second token would need to be checked for
validity
by the gadget server as well, so for this possibly a second shared
secret is needed.

Reinoud

[1] http://code.google.com/apis/opensocial/docs/0.7/spec.html#remote

Re: bridge between the container and the gadget server

Posted by Kevin Brown <et...@google.com>.
On Feb 1, 2008 12:04 PM, Brian Eaton <be...@google.com> wrote:

> Reinoud's post about his first steps with Shindig sparked an
> interesting discussion I want to pull into a separate thread.  Our
> story so far:
>
> Reinoud suggested that the container and the gadget server not need to
> share the same data sources, just a few encryption keys.[1]
>
> Kevin agreed. [2]
>
> I said I didn't think not sharing data sources was realistic, because
> too much information would need to go in the security token. [3]
>
> Kevin also agreed with that, at which point I got confused.
>
> The main reason I think we'll need to share data sources between the
> container and the gadget server is OAuth; there are per user access
> tokens that the gadget server needs access to.  That implies the
> container and the gadget server are both using the same backend for
> their users.  Or am I missing something?


Every container could have it's own back end that understands the security
token. There's no need to pass anything other than the most basic data
required to authenticate. Example:

Container generates token that contains: current viewer, owner of the
current page,  and the url of the gadget that was rendered. It gets passed
to the iframe as #st=<base 64 encoded token>

opensocial feature uses gadgets.io.makeRequest and forwards the token itself
to the target back end (alternatively, if it's on the same host, it could
simply make a normal XHR).

App data back end decrypts the token and returns data for whatever the
current request requires (friend graph, app data, whatever).

The *gadget server* doesn't care about authentication (other than validation
of tokens in some special cases, like signed proxy requests). It's the *app
data* servers that actually need to know about this. It's possible for the
gadget server to also be an app data server, of course, but I think that
this is impractical for real websites.