public class AuthorizationCodeConnection extends Object implements ADPAPIConnection
AuthorizationCodeConnection is an implementation of ADPAPIConnection
with GrantType authorization_code.
AuthorizationCodeConnection exposes the common methods that are available for processing a authorization connection request
AuthorizationCodeConnection,
ClientCredentialsConnection| Modifier and Type | Field and Description |
|---|---|
private String |
authorizationUrl |
private ConnectionConfiguration |
connectionConfiguration |
private String |
errorResponse |
private boolean |
isConnectionAlive |
private static Logger |
LOGGER |
private String |
refreshToken |
private Token |
token |
private double |
tokenTimeTracker |
| Modifier | Constructor and Description |
|---|---|
protected |
AuthorizationCodeConnection()
constructor
|
|
AuthorizationCodeConnection(ConnectionConfiguration connectionConfiguration)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Initiates a connect request to ADP Authorization Server on the type of
connection configuration.
|
void |
disconnect()
Invokes API to disconnect the connection - currently this method is implemented
to reset the connection to null.
|
String |
getAuthorizationUrl()
Returns Authorization Url after building it from configuration
|
ConnectionConfiguration |
getConnectionConfiguration()
Returns the Connection configuration
|
String |
getErrorResponse()
Returns errors
|
String |
getRefreshToken()
Returns a new token from server if the current token is still valid and
hasn't expired
|
Token |
getToken()
Returns the token on this connection
|
boolean |
isConnectionIndicator()
Returns true or false based on the validation or access token.
|
private boolean |
isValidToken()
Returns true if token is still valid since issued based on delta of
current time and token time tracker that has the token expired time
|
void |
setConnectionConfiguration(ConnectionConfiguration connectionConfiguration)
Maps the connection configuration
AuthorizationCodeConfiguration
to this connection |
void |
setErrorResponse(String errorResponse) |
void |
setToken(Token token)
Sets the tokens on this connection
|
private static final Logger LOGGER
private boolean isConnectionAlive
private double tokenTimeTracker
private String errorResponse
private String authorizationUrl
private String refreshToken
private ConnectionConfiguration connectionConfiguration
private Token token
protected AuthorizationCodeConnection()
public AuthorizationCodeConnection(ConnectionConfiguration connectionConfiguration)
connectionConfiguration - sets configuration to this connectionpublic void connect()
throws ConnectionException
Token is mapped with this connection. In case of error,
connection exceptions are thrown or error details are returnedconnect in interface ADPAPIConnectionConnectionException - exception thrown when validation fails on configuration
and connectionpublic void disconnect()
throws ConnectionException
disconnect in interface ADPAPIConnectionConnectionException - throws exceptions in the event of objectpublic String getAuthorizationUrl() throws ConnectionException
ConnectionException - throws exception if connection
configuration is nullpublic boolean isConnectionIndicator()
isConnectionIndicator in interface ADPAPIConnectionpublic String getRefreshToken()
public ConnectionConfiguration getConnectionConfiguration()
public void setConnectionConfiguration(ConnectionConfiguration connectionConfiguration)
AuthorizationCodeConfiguration
to this connectionconnectionConfiguration - maps AuthorizationCodeConfiguration to
this connection configurationpublic Token getToken()
getToken in interface ADPAPIConnectionTokenpublic void setToken(Token token)
token - sets token to this connectionpublic String getErrorResponse()
public void setErrorResponse(String errorResponse)
errorResponse - sets the http error statusprivate boolean isValidToken()
Copyright © 2016 ADP LLC. All rights reserved.