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)
           
 AccessToken extendTokenExpiration()
          Extends this instance's short-lived-token expiration.
 AccessToken extendTokenExpiration(String shortLivedToken)
          Extends the short-lived-token expiration.
 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 getOAuthAccessTokenInfo()
          Returns the access token information.
 AccessToken getOAuthAccessTokenInfo(String accessToken)
          Returns the access token information.
 AccessToken getOAuthAppAccessToken()
          Returns an App Access Token.
 String getOAuthAuthorizationURL(String callbackURL)
           
 String getOAuthAuthorizationURL(String callbackURL, AuthOption authOption)
           
 String getOAuthAuthorizationURL(String callbackURL, String state)
           
 String getOAuthCallbackURL()
          Sets the access token and callback URL
 DeviceCode getOAuthDeviceCode()
          Returns a generated device code.
 AccessToken getOAuthDeviceToken(DeviceCode deviceCode)
          Returns a Device Access Token.
 String getOAuthReAuthenticationURL(String callbackURL, String nonce)
          Returns the URL that asks the person to re-authenticate unconditionally.
 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

getOAuthAuthorizationURL

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

getOAuthReAuthenticationURL

public String getOAuthReAuthenticationURL(String callbackURL,
                                          String nonce)
Description copied from interface: OAuthSupport
Returns the URL that asks the person to re-authenticate unconditionally.

Specified by:
getOAuthReAuthenticationURL in interface OAuthSupport
Parameters:
callbackURL - callback url
nonce - a completely arbitrary alphanumeric code that your app generates. see: The auth_nonce parameter
Returns:
the url for re-authenticate
See Also:
Re-authentication - Facebook Login

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

getOAuthDeviceCode

public DeviceCode getOAuthDeviceCode()
                              throws FacebookException
Description copied from interface: OAuthSupport
Returns a generated device code.

Specified by:
getOAuthDeviceCode in interface OAuthSupport
Returns:
Device code
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Facebook Login for Devices

getOAuthDeviceToken

public AccessToken getOAuthDeviceToken(DeviceCode deviceCode)
                                throws FacebookException
Description copied from interface: OAuthSupport
Returns a Device Access Token.

Specified by:
getOAuthDeviceToken in interface OAuthSupport
Returns:
Device Acceess Token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Facebook Login for Devices

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

extendTokenExpiration

public AccessToken extendTokenExpiration(String shortLivedToken)
                                  throws FacebookException
Description copied from interface: OAuthSupport
Extends the short-lived-token expiration.

Specified by:
extendTokenExpiration in interface OAuthSupport
Parameters:
shortLivedToken - access token
Returns:
extended access token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Expiration and Extension of Access Tokens - Facebook Login

extendTokenExpiration

public AccessToken extendTokenExpiration()
                                  throws FacebookException
Description copied from interface: OAuthSupport
Extends this instance's short-lived-token expiration.

Specified by:
extendTokenExpiration in interface OAuthSupport
Returns:
extended access token
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized
See Also:
Expiration and Extension of Access Tokens - Facebook Login

getOAuthAccessTokenInfo

public AccessToken getOAuthAccessTokenInfo(String accessToken)
                                    throws FacebookException
Description copied from interface: OAuthSupport
Returns the access token information.

Specified by:
getOAuthAccessTokenInfo in interface OAuthSupport
Parameters:
accessToken - access token
Returns:
access token information
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized

getOAuthAccessTokenInfo

public AccessToken getOAuthAccessTokenInfo()
                                    throws FacebookException
Description copied from interface: OAuthSupport
Returns the access token information.

Specified by:
getOAuthAccessTokenInfo in interface OAuthSupport
Returns:
access token information
Throws:
FacebookException - when Facebook service or network is unavailable, or the user has not authorized

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 © 2019. All rights reserved.