org.apache.shindig.social.core.oauth2
Class OAuth2Code

java.lang.Object
  extended by org.apache.shindig.social.core.oauth2.OAuth2Code
All Implemented Interfaces:
java.lang.Comparable<OAuth2Code>

public class OAuth2Code
extends java.lang.Object
implements java.lang.Comparable<OAuth2Code>

Represents a "code" string in an OAuth 2.0 handshake, including authorization code, access token, or refresh token. These signatures may all expire. They may also be associated with a redirect_url and/or another code.


Constructor Summary
OAuth2Code()
           
OAuth2Code(java.lang.String value)
          Constructs an OAuth2Code with a value.
OAuth2Code(java.lang.String value, java.lang.String redirectURI, long expiration, java.util.List<java.lang.String> scope)
          Constructs an OAuth2Code.
 
Method Summary
 int compareTo(OAuth2Code target)
          Compares this code to another code.
 OAuth2Client getClient()
          Returns the client associated with this code.
 long getExpiration()
          Returns when this code expires.
 java.lang.String getRedirectURI()
          Returns the redirect URI associated with this code.
 OAuth2Code getRelatedAccessToken()
          Gets the related access token.
 OAuth2Code getRelatedAuthCode()
          Returns the authorization code related to this code.
 OAuth2Code getRelatedRefreshToken()
          Gets the related refresh token.
 java.util.List<java.lang.String> getScope()
          Returns the scope of this code.
 OAuth2Types.CodeType getType()
          Returns the type of this code.
 java.lang.String getValue()
          Returns the value of this code.
 void setClient(OAuth2Client client)
          Sets the client associated with this code.
 void setExpiration(long expiration)
          Sets the expiration of this code.
 void setRedirectURI(java.lang.String redirectURI)
          Sets the redirect URI associated with this code.
 void setRelatedAccessToken(OAuth2Code relatedAccessToken)
          Sets the related access token.
 void setRelatedAuthCode(OAuth2Code code)
          Sets the authorization code that this code is related to, if applicable.
 void setRelatedRefreshToken(OAuth2Code relatedRefreshToken)
          Sets the related refresh token.
 void setScope(java.util.List<java.lang.String> scope)
          Sets the scope of this code.
 void setType(OAuth2Types.CodeType type)
          Sets the type of this code; one of AUTHORIZATION_CODE, ACCESS_TOKEN, REFRESH_TOKEN
 void setValue(java.lang.String value)
          Sets the value of this code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAuth2Code

public OAuth2Code()

OAuth2Code

public OAuth2Code(java.lang.String value,
                  java.lang.String redirectURI,
                  long expiration,
                  java.util.List<java.lang.String> scope)
Constructs an OAuth2Code.

Parameters:
value - is the String key that makes up the code
redirectURI - is redirect URI associated with this code
expiration - indicates when this code expires
scope - indicates the scope of this code

OAuth2Code

public OAuth2Code(java.lang.String value)
Constructs an OAuth2Code with a value.

Parameters:
value - is the String key that makes up the code
Method Detail

getValue

public java.lang.String getValue()
Returns the value of this code.

Returns:
String is the key of this code

setValue

public void setValue(java.lang.String value)
Sets the value of this code.

Parameters:
value - is the value to set this code to

getRedirectURI

public java.lang.String getRedirectURI()
Returns the redirect URI associated with this code.

Returns:
String represents this code's redirect URI

setRedirectURI

public void setRedirectURI(java.lang.String redirectURI)
Sets the redirect URI associated with this code.

Parameters:
redirectURI - represents the redirect URI of this code

getExpiration

public long getExpiration()
Returns when this code expires.

Returns:
long represents when this code will expire

setExpiration

public void setExpiration(long expiration)
Sets the expiration of this code.

Parameters:
expiration - is when this code will expire

compareTo

public int compareTo(OAuth2Code target)
Compares this code to another code.

Specified by:
compareTo in interface java.lang.Comparable<OAuth2Code>
Returns:
int indicates how the value of this code compares to another

getScope

public java.util.List<java.lang.String> getScope()
Returns the scope of this code.

Returns:
List represents the scope of this code

setScope

public void setScope(java.util.List<java.lang.String> scope)
Sets the scope of this code.

Parameters:
scope - is this code's authorized scope

setClient

public void setClient(OAuth2Client client)
Sets the client associated with this code.

Parameters:
client - is the client to associate with this code

getClient

public OAuth2Client getClient()
Returns the client associated with this code.

Returns:
OAuth2Client represents the client associated with this code

setType

public void setType(OAuth2Types.CodeType type)
Sets the type of this code; one of AUTHORIZATION_CODE, ACCESS_TOKEN, REFRESH_TOKEN

Parameters:
type - is this code's type

getType

public OAuth2Types.CodeType getType()
Returns the type of this code.

Returns:
CodeType represents the type of this code

setRelatedAuthCode

public void setRelatedAuthCode(OAuth2Code code)
Sets the authorization code that this code is related to, if applicable.

Parameters:
code - is the authorization code to associate with this code

getRelatedAuthCode

public OAuth2Code getRelatedAuthCode()
Returns the authorization code related to this code.

Returns:
OAuth2Code is the authorization code related to this code

setRelatedRefreshToken

public void setRelatedRefreshToken(OAuth2Code relatedRefreshToken)
Sets the related refresh token.

Parameters:
relatedRefreshToken - is the refresh token related to this code

getRelatedRefreshToken

public OAuth2Code getRelatedRefreshToken()
Gets the related refresh token.

Returns:
OAuth2Code is the refresh token related to this code

setRelatedAccessToken

public void setRelatedAccessToken(OAuth2Code relatedAccessToken)
Sets the related access token.

Parameters:
relatedAccessToken - is the access token related to this code

getRelatedAccessToken

public OAuth2Code getRelatedAccessToken()
Gets the related access token.

Returns:
OAuth2Code is the access token related to this code


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.