org.restlet.ext.oauth
Class AuthenticatedUser

java.lang.Object
  extended by org.restlet.ext.oauth.AuthenticatedUser

public abstract class AuthenticatedUser
extends Object

POJO for keeping a grant that a user has approved. User with a specific id has granted a set of scopes. Implementors should implement the storage and retrieval.

Author:
Kristoffer Gronowski

Constructor Summary
AuthenticatedUser()
           
 
Method Summary
abstract  void addRole(Role r, String owner)
          Adds a scope for this user given a specified owner.
abstract  void clearCode()
          Removes a generated code that was used or revoked.
abstract  Client getClient()
          Gets the client object that associated and created this user.
abstract  String getCode()
          Returns the current oauth code if any available for exchange for a token.
abstract  List<Role> getGrantedRoles()
          Gets all scopes.
abstract  String getId()
          Returns the identifier of the user.
abstract  String getPassword()
          Password field for the username and password oauth flow.
abstract  org.restlet.ext.oauth.internal.Token getToken()
          Returns the currently issued token for this user.
abstract  long getTokenExpire()
          Returns the default token expire time for this user.
abstract  boolean isGrantedRole(Role role, String owner)
          Checks if this user has a specific scope.
 boolean persist()
          Helper method to indicate when to checkpoint the user data.
abstract  void revokeRole(Role role, String owner)
          Removes a specific scope.
abstract  void revokeRoles()
          Revokes previously granted scopes.
abstract  void setCode(String code)
          Sets a generated code that was given out for this user.
abstract  void setPassword(String password)
          Sets the user password
abstract  void setToken(org.restlet.ext.oauth.internal.Token token)
          Sets the current issued token.
abstract  void setTokenExpire(long deltaTimeSec)
          Sets the time for all token expire time for this user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthenticatedUser

public AuthenticatedUser()
Method Detail

addRole

public abstract void addRole(Role r,
                             String owner)
Adds a scope for this user given a specified owner.


clearCode

public abstract void clearCode()
Removes a generated code that was used or revoked.


getClient

public abstract Client getClient()
Gets the client object that associated and created this user. The Client corresponds to a service provider that acts on behalf of a Authenticated user.

Returns:
The parent client instance.

getCode

public abstract String getCode()
Returns the current oauth code if any available for exchange for a token.

Returns:
the current oauth code if any available for exchange for a token.

getGrantedRoles

public abstract List<Role> getGrantedRoles()
Gets all scopes. Observe that no owner information is passed.


getId

public abstract String getId()
Returns the identifier of the user.

Returns:
The identifier of the user.

getPassword

public abstract String getPassword()
Password field for the username and password oauth flow.

Returns:
password or null if not present

getToken

public abstract org.restlet.ext.oauth.internal.Token getToken()
Returns the currently issued token for this user.

Returns:
The currently issued token for this user.

getTokenExpire

public abstract long getTokenExpire()
Returns the default token expire time for this user.

Returns:
The default token expire time for this user.

isGrantedRole

public abstract boolean isGrantedRole(Role role,
                                      String owner)
Checks if this user has a specific scope.

Parameters:
role - The scope to check.
owner - The owner.
Returns:
True if this user has the scope.

persist

public boolean persist()
Helper method to indicate when to checkpoint the user data. If not handling permanent persistence should return true.

Returns:
true if stored - false if the caller wants to abort

revokeRole

public abstract void revokeRole(Role role,
                                String owner)
Removes a specific scope.

Parameters:
role - The scope to be removed.
owner - The scope owner.

revokeRoles

public abstract void revokeRoles()
Revokes previously granted scopes.


setCode

public abstract void setCode(String code)
Sets a generated code that was given out for this user.

Parameters:
code - The generated code.

setPassword

public abstract void setPassword(String password)
Sets the user password

Parameters:
password - The user password.

setToken

public abstract void setToken(org.restlet.ext.oauth.internal.Token token)
Sets the current issued token.

Parameters:
token - The current issued token.

setTokenExpire

public abstract void setTokenExpire(long deltaTimeSec)
Sets the time for all token expire time for this user.

Parameters:
deltaTimeSec - The time for all token expire time for this user.


Copyright © 2005-2013 Restlet.