facebook4j.auth
Class OAuthAuthorization

java.lang.Object
  extended by facebook4j.auth.OAuthAuthorization
All Implemented Interfaces:
Authorization, OAuthSupport, Security, Serializable

public class OAuthAuthorization
extends Object
implements Authorization, OAuthSupport, Security, Serializable

Author:
Ryuji Yamashita - roundrop at gmail.com
See Also:
OAuth Core 1.0a, Serialized Form

Field Summary
static String HMAC_SHA_256
           
 
Constructor Summary
OAuthAuthorization(Configuration conf)
           
 
Method Summary
 boolean equals(Object obj)
           
 String generateAppSecretProof()
          Computes a appsecret_proof value using the HMAC method.
 AccessToken getOAuthAccessToken()
          Returns an access token associated with this instance.
 AccessToken getOAuthAccessToken(String oauthCode)
          Exchange the code for a User Access Token.
 AccessToken getOAuthAccessToken(String oauthCode, String callbackURL)
          Exchange the code for a User Access Token.
 AccessToken getOAuthAppAccessToken()
          Returns an App Access Token.
 String getOAuthAuthorizationURL(String callbackURL)
           
 String getOAuthAuthorizationURL(String callbackURL, String state)
           
 String getOAuthCallbackURL()
          Sets the access token and callback URL
 int hashCode()
           
 boolean isAppSecretProofEnabled()
           
 boolean isEnabled()
          #{inheritDoc}
 void setAppSecretProofEnabled(boolean enabled)
           
 void setOAuthAccessToken(AccessToken accessToken)
          Sets the access token
 void setOAuthAccessToken(AccessToken accessToken, String callbackURL)
           
 void setOAuthAppId(String appId, String appSecret)
          sets the OAuth AppID and App secret
 void setOAuthCallbackURL(String callbackURL)
          Sets the access token
 void setOAuthPermissions(String permissions)
          sets the permissions
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HMAC_SHA_256

public static final String HMAC_SHA_256
See Also:
Constant Field Values
Constructor Detail

OAuthAuthorization

public OAuthAuthorization(Configuration conf)
Parameters:
conf - Configuration
Method Detail

isEnabled

public boolean isEnabled()
#{inheritDoc}

Specified by:
isEnabled in interface Authorization
Returns:
true if authorization credentials are set

getOAuthAuthorizationURL

public String getOAuthAuthorizationURL(String callbackURL)
Specified by:
getOAuthAuthorizationURL in interface OAuthSupport

getOAuthAuthorizationURL

public String getOAuthAuthorizationURL(String callbackURL,
                                       String state)
Specified by:
getOAuthAuthorizationURL in interface OAuthSupport

getOAuthAccessToken

public AccessToken getOAuthAccessToken(String oauthCode)
                                throws FacebookException
Description copied from interface: OAuthSupport
Exchange the code for a User Access Token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
oauthCode - OAuth code.
Returns:
User Access Token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Server-Side Authentication

getOAuthAccessToken

public AccessToken getOAuthAccessToken(String oauthCode,
                                       String callbackURL)
                                throws FacebookException
Description copied from interface: OAuthSupport
Exchange the code for a User Access Token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
oauthCode - OAuth code.
callbackURL - callback URL
Returns:
User Access Token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Server-Side Authentication

getOAuthAccessToken

public AccessToken getOAuthAccessToken()
Description copied from interface: OAuthSupport
Returns an access token associated with this instance.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Returns:
access token
See Also:
Server-Side Authentication

getOAuthAppAccessToken

public AccessToken getOAuthAppAccessToken()
                                   throws FacebookException
Description copied from interface: OAuthSupport
Returns an App Access Token.

Specified by:
getOAuthAppAccessToken in interface OAuthSupport
Returns:
App Access Token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Server-Side Authentication

setOAuthAccessToken

public void setOAuthAccessToken(AccessToken accessToken)
Description copied from interface: OAuthSupport
Sets the access token

Specified by:
setOAuthAccessToken in interface OAuthSupport
Parameters:
accessToken - access token

setOAuthAccessToken

public void setOAuthAccessToken(AccessToken accessToken,
                                String callbackURL)

getOAuthCallbackURL

public String getOAuthCallbackURL()
Description copied from interface: OAuthSupport
Sets the access token and callback URL

Specified by:
getOAuthCallbackURL in interface OAuthSupport
Returns:
Callback URL

setOAuthCallbackURL

public void setOAuthCallbackURL(String callbackURL)
Description copied from interface: OAuthSupport
Sets the access token

Specified by:
setOAuthCallbackURL in interface OAuthSupport
Parameters:
callbackURL - Callback URL

setOAuthAppId

public void setOAuthAppId(String appId,
                          String appSecret)
Description copied from interface: OAuthSupport
sets the OAuth AppID and App secret

Specified by:
setOAuthAppId in interface OAuthSupport
Parameters:
appId - OAuth AppID
appSecret - OAuth App secret

setOAuthPermissions

public void setOAuthPermissions(String permissions)
Description copied from interface: OAuthSupport
sets the permissions

Specified by:
setOAuthPermissions in interface OAuthSupport
Parameters:
permissions - comma-separated permission names
See Also:
Permissions Reference

setAppSecretProofEnabled

public void setAppSecretProofEnabled(boolean enabled)

isAppSecretProofEnabled

public boolean isAppSecretProofEnabled()
Specified by:
isAppSecretProofEnabled in interface Security

generateAppSecretProof

public String generateAppSecretProof()
Computes a appsecret_proof value using the HMAC method.

Specified by:
generateAppSecretProof in interface Security
Returns:
appsecret_proof
See Also:
Verifying Graph API Calls with appsecret_proof

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.