nl.surfnet.coin.api.client
Class OpenConextOAuthClientImpl

java.lang.Object
  extended by nl.surfnet.coin.api.client.OpenConextOAuthClientImpl
All Implemented Interfaces:
OpenConextOAuthClient, org.springframework.beans.factory.InitializingBean

public class OpenConextOAuthClientImpl
extends Object
implements OpenConextOAuthClient, org.springframework.beans.factory.InitializingBean

Implementation of OpenConextOAuthClient


Constructor Summary
OpenConextOAuthClientImpl()
           
 
Method Summary
 void afterPropertiesSet()
           
 String getAuthorizationUrl()
          Get the authorization url
 Group20 getGroup20(String userId, String groupId, String onBehalfOf)
          Get group information about the given group, for the given user.
 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(javax.servlet.http.HttpServletRequest request, String onBehalfOf)
          Clients who have requested a redirect to the authorization URL will be notified on the registered callback URL.
 void setCallbackUrl(String url)
           
 void setConsumerKey(String key)
           
 void setConsumerSecret(String secret)
           
 void setEndpointBaseUrl(String url)
           
 void setRepository(OAuthRepository repository)
           
 void setVersion(OAuthVersion v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenConextOAuthClientImpl

public OpenConextOAuthClientImpl()
Method Detail

isAccessTokenGranted

public boolean isAccessTokenGranted(String userId)
Description copied from interface: OpenConextOAuthClient
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.

Specified by:
isAccessTokenGranted in interface OpenConextOAuthClient
Parameters:
userId - the unique identifier
Returns:
true if there is a valid access token for the user

getAuthorizationUrl

public String getAuthorizationUrl()
Description copied from interface: OpenConextOAuthClient
Get the authorization url

Specified by:
getAuthorizationUrl in interface OpenConextOAuthClient
Returns:
the authorization url

oauthCallback

public void oauthCallback(javax.servlet.http.HttpServletRequest request,
                          String onBehalfOf)
Description copied from interface: OpenConextOAuthClient
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.

Specified by:
oauthCallback in interface OpenConextOAuthClient
Parameters:
request - the HTTP request for obtaining the request token
onBehalfOf - the userId of the end user

getPerson

public Person getPerson(String userId,
                        String onBehalfOf)
Description copied from interface: OpenConextOAuthClient
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.

Specified by:
getPerson in interface OpenConextOAuthClient
Parameters:
userId - the unique identifier
onBehalfOf - the unique identifier of the user that is going to make the request
Returns:
the Person

getGroupMembers

public List<Person> getGroupMembers(String groupId,
                                    String onBehalfOf)
Description copied from interface: OpenConextOAuthClient
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.

Specified by:
getGroupMembers in interface OpenConextOAuthClient
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

public List<Group> getGroups(String userId,
                             String onBehalfOf)
Description copied from interface: OpenConextOAuthClient
Get Persons' Groups

Specified by:
getGroups in interface OpenConextOAuthClient
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

public List<Group20> getGroups20(String userId,
                                 String onBehalfOf)
Description copied from interface: OpenConextOAuthClient
Get Persons' Groups

Specified by:
getGroups20 in interface OpenConextOAuthClient
Parameters:
userId - the unique identifier
onBehalfOf - the unique identifier of the user that is going to make the request
Returns:
List containing the Groups

getGroup20

public Group20 getGroup20(String userId,
                          String groupId,
                          String onBehalfOf)
Description copied from interface: OpenConextOAuthClient
Get group information about the given group, for the given user.

Specified by:
getGroup20 in interface OpenConextOAuthClient
Parameters:
userId - the userId that is a member of the given group
groupId - the groupId of the group
onBehalfOf - id of the end user on whose behalf this call is done.
Returns:
Group object

setCallbackUrl

public void setCallbackUrl(String url)

setConsumerSecret

public void setConsumerSecret(String secret)

setConsumerKey

public void setConsumerKey(String key)

setEndpointBaseUrl

public void setEndpointBaseUrl(String url)

setVersion

public void setVersion(OAuthVersion v)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

setRepository

public void setRepository(OAuthRepository repository)


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