nl.surfnet.coin.api.client
Interface OpenConextOAuthClient

All Known Implementing Classes:
OpenConextOAuthClientImpl

public interface OpenConextOAuthClient

Capable of retrieving OpenSocial data from OpenSocial endpoints


Method Summary
 String getAuthorizationUrl(OAuthVersion version)
          Get the authorization url
 List<Person> getGroupMembers(String groupId, String onBehalfOf)
          Get the group members of the given group.
 List<Group> getGroups(String userId, String onBehalfOf)
          Get Persons' Groups
 List<Group20> getGroups20(String userId, String onBehalfOf)
          Get Persons' Groups
 Person getPerson(String userId, String onBehalfOf)
          Get the OpenSocial Person.
 boolean isAccessTokenGranted(String userId)
          Is it possible to make OpenSocial requests for this user (as onBehalfOf).
 void oauthCallback(OAuthVersion version, javax.servlet.http.HttpServletRequest request)
          Clients who have requested a redirect to the authorization URL will be notified on the registered callback URL.
 void redirectToAuthorizationUrl(OAuthVersion version, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Clients who wants to make three-legged calls, but who do not have an access token yet for an user can redirect to the authorization URL.
 

Method Detail

isAccessTokenGranted

boolean isAccessTokenGranted(String userId)
Is it possible to make OpenSocial requests for this user (as onBehalfOf). In principle clients need to make this check every time they want to make a three-legged oauth call.

Parameters:
userId - the unique identifier
Returns:
true if there is a valid access token for the user

redirectToAuthorizationUrl

void redirectToAuthorizationUrl(OAuthVersion version,
                                javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
Clients who wants to make three-legged calls, but who do not have an access token yet for an user can redirect to the authorization URL. Note that the Response will be used to actually redirect to.

Parameters:
version - the OAuth protocol version to use
request - the HTTP request for obtaining the request token
response - the HTTP response for redirecting to the authorization url

getAuthorizationUrl

String getAuthorizationUrl(OAuthVersion version)
Get the authorization url

Parameters:
version - the oauth version
Returns:
the authorization url

oauthCallback

void oauthCallback(OAuthVersion version,
                   javax.servlet.http.HttpServletRequest request)
Clients who have requested a redirect to the authorization URL will be notified on the registered callback URL. For extracting the oauth access token they will need to 'forward' the call back request to this method.

Parameters:
version - the OAuth protocol version to use
request - the HTTP request for obtaining the request token

getPerson

Person getPerson(String userId,
                 String onBehalfOf)
Get the OpenSocial Person. Note that the onBehalfOf is only necessary if this is a three-legged call (e.g. there is an access token for the onBehalfOf). For two legged calls the onBehalfOf can be null.

Parameters:
userId - the unique identifier
onBehalfOf - the unique identifier of the user that is going to make the request
Returns:
the Person

getGroupMembers

List<Person> getGroupMembers(String groupId,
                             String onBehalfOf)
Get the group members of the given group. Note that the onBehalfOf is only necessary if this is a three-legged call (e.g. there is an access token for the onBehalfOf). For two legged calls the onBehalfOf can be null.

Parameters:
groupId - String the unique identifier for the group
onBehalfOf - String the unique identifier of the user that is going to make the request
Returns:
an ArrayList containing Person's

getGroups

List<Group> getGroups(String userId,
                      String onBehalfOf)
Get Persons' Groups

Parameters:
userId - the unique identifier
onBehalfOf - the unique identifier of the user that is going to make the request
Returns:
List containing the Groups

getGroups20

List<Group20> getGroups20(String userId,
                          String onBehalfOf)
Get Persons' Groups

Parameters:
userId - the unique identifier
onBehalfOf - the unique identifier of the user that is going to make the request
Returns:
List containing the Groups


Copyright © 2009-2012 SURFnet bv, The Netherlands. All Rights Reserved.