org.restlet.ext.oauth
Class ClientStore<G extends org.restlet.ext.oauth.internal.TokenGenerator>

java.lang.Object
  extended by org.restlet.ext.oauth.ClientStore<G>

public abstract class ClientStore<G extends org.restlet.ext.oauth.internal.TokenGenerator>
extends Object

Abstract class that defines a client store for the Authentication Server. The following code adds a client to a store when you create your inbound root

 {
 @code
 public synchronized Restlet createInboundRoot(){
   ClientStore clientStore = ClientStoreFactory.getInstance();
   clientStore.createClient("1234567890","1234567890",
    "http://localhost:8080");
  
   attribs.put(ClientStore.class.getCanonicalName(), clientStore);
 }
 }
 

Author:
Kristoffer Gronowski

Constructor Summary
protected ClientStore(G generator)
          Constructor.
 
Method Summary
abstract  Client createClient(String clientId, String redirectUri)
          Useful only for clients using the user agent oauth flow where secret is never used
abstract  Client createClient(String clientId, String clientSecret, String redirectUri)
          Used for creating a data entry representation for a oauth client
abstract  void deleteClient(String id)
          Delete a client_id from the implementing backed database.
abstract  Client findById(String id)
          Search for a client_id if present in the database.
abstract  Collection<? extends Client> findClientsForUser(String userid)
          Function to find all granted client for a specific authenticated use.
 G getTokenGenerator()
          Returns the token generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientStore

protected ClientStore(G generator)
Constructor.

Parameters:
generator - The token generator.
Method Detail

createClient

public abstract Client createClient(String clientId,
                                    String redirectUri)
Useful only for clients using the user agent oauth flow where secret is never used

Parameters:
clientId - oauth client_id entry for a new client
redirectUri - the URL that should be used for oauth callbacks
Returns:
client POJO

createClient

public abstract Client createClient(String clientId,
                                    String clientSecret,
                                    String redirectUri)
Used for creating a data entry representation for a oauth client

Parameters:
clientId - oauth client_id entry for a new client
clientSecret - oauth client_secret entry for a new client
redirectUri - the URL that should be used for oauth callbacks
Returns:
client POJO

deleteClient

public abstract void deleteClient(String id)
Delete a client_id from the implementing backed database.

Parameters:
id - client_id of the client to remove

findById

public abstract Client findById(String id)
Search for a client_id if present in the database.

Parameters:
id - client_id to search for.
Returns:
client POJO or null if not found.

findClientsForUser

public abstract Collection<? extends Client> findClientsForUser(String userid)
Function to find all granted client for a specific authenticated use. Useful for implementing a revocation page where a specific user should be able to opt out.

Parameters:
userid - id of the user to retrieve. (openid)
Returns:
active clients or empty collection.

getTokenGenerator

public G getTokenGenerator()
Returns the token generator.

Returns:
an instance of the TokenGenerator


Copyright © 2005-2013 Restlet.