...
There's a code example here:
http://code.google.com/apis/gdata/docs/auth/oauth.html#2LeggedOAuth
another example:
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/oauth/TwoLeggedOAuthExample.java
From
To retrieve all groups in a particular domain, use the following GET request:
GET [https://apps-apis.google.com/a/feeds/group/2.0/domain[?[start|https://apps-apis.google.com/a/feeds/group/2.0/domain[?start=]]
To retrieve all the groups for a particular member [in a domain], use the following GET request:
GET [https://apps-apis.google.com/a/feeds/group/2.0/domain/?member=memberId[&directOnly=true|false|https://apps-apis.google.com/a/feeds/group/2.0/domain/?member=memberId&directOnly=true]
directOnly - If true, the request identifies only members with direct association with the group.
Tried the first query, i.e.
GET https://apps-apis.google.com/a/feeds/group/2.0/sagebionetworks.com
with these request properties:
conn.setRequestProperty("Authorization: OAuth",
"oauth_consumer_key=sandbox-sagebionetworks.appspot.com, "
"oauth_nonce="+nonce()", "
+"oauth_signature_method=HMAC-SHA1, "
+"oauth_signature=OrB7tgg7BJtAkn9uvbo14uC9"
+"oauth_timestamp="+System.currentTimeMillis()
);
Result: Got 401 OK
:^(
Added xoauth_requestor_id param in the URL
Result: Got 401 OK
:^(
Will try Google example from here:
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/oauth/TwoLeggedOAuthExample.java
Went here to get the Java API
http://code.google.com/p/google-api-java-client/
downloaded the file
google-api-client-1.2.1-alpha-java.zip
Next steps:
1. Complete the installation
2. Get the google example running
Need google data java client:
http://code.google.com/apis/gdata/articles/java_client_lib.html
Chose this
http://code.google.com/p/gdata-java-client/downloads/detail?name=gdata-src.java-1.42.0.zip&can=2&q=
extracted the file to c:/users/hoff/eclipse
there are a lot of files, including source
ran the project but got 'classnotfound' exceptions
had to copy files to war/web-inf/lib in addition to adding them to the project as external jars
got
java.lang.NoClassDefFoundError: com/google/common/collect/Maps
and put directly into the war/web-inf/lib (not build path)
app now runs.
Fixed a couple nullptr exceptions and it ran w/o error.
Restored the security-constraint to the web.xml file (accidentally erased).
Deployed to GAE.
It works! I had to iterate on the code example to get the group information out,
but eventually saw the two groups 'demo' and 'test' in the sagebionetworks.com domain.
Next step: retrieve group membership for a user.
Done: The authorization demo now runs -- comparing user's groups to those authorized for a service.
Notes
Q: What's the cumulative file size on the Sage SSH server?
...