Package com.hellosign.sdk.http
Class Authentication
- java.lang.Object
-
- com.hellosign.sdk.http.Authentication
-
public class Authentication extends java.lang.ObjectThis class provides convenience methods for handling authentication information for a HelloSignClient instance. We usually only want to use one of these methods, but don't necessarily want to have to pass around all of the information in method parameters.
-
-
Constructor Summary
Constructors Constructor Description Authentication()Authentication(Authentication clone)Authentication(java.lang.String apiKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthenticate(java.net.HttpURLConnection httpConn, java.lang.String url)Authorizes the HTTP connection using this instance's credentials.java.lang.StringgetAccessToken()Returns a protected copy of the access token.java.lang.StringgetAccessTokenType()Returns a protected copy of the access token type string.java.lang.StringgetApiKey()Returns a protected copy of the API key String.booleanhasAccessToken()Returns true if an access token and token type have been provided.booleanhasApiKey()Returns true if the API Key has been set.voidsetAccessToken(java.lang.String accessToken, java.lang.String tokenType)Sets the access token for the HelloSign client authentication.voidsetApiKey(java.lang.String apiKey)Sets the API key to use for authenticating this client.
-
-
-
Constructor Detail
-
Authentication
public Authentication()
-
Authentication
public Authentication(java.lang.String apiKey)
-
Authentication
public Authentication(Authentication clone) throws HelloSignException
- Throws:
HelloSignException
-
-
Method Detail
-
getApiKey
public java.lang.String getApiKey()
Returns a protected copy of the API key String.- Returns:
- String API key
-
setApiKey
public void setApiKey(java.lang.String apiKey)
Sets the API key to use for authenticating this client.- Parameters:
apiKey- String API Key
-
hasApiKey
public boolean hasApiKey()
Returns true if the API Key has been set.- Returns:
- true, or false if the key is empty
-
getAccessToken
public java.lang.String getAccessToken()
Returns a protected copy of the access token.- Returns:
- String access token
-
getAccessTokenType
public java.lang.String getAccessTokenType()
Returns a protected copy of the access token type string.- Returns:
- String access token type
-
setAccessToken
public void setAccessToken(java.lang.String accessToken, java.lang.String tokenType) throws HelloSignExceptionSets the access token for the HelloSign client authentication.- Parameters:
accessToken- StringtokenType- String- Throws:
HelloSignException- if either the accessToken or tokenType are null
-
hasAccessToken
public boolean hasAccessToken()
Returns true if an access token and token type have been provided.- Returns:
- true or false if either are not set
-
authenticate
public void authenticate(java.net.HttpURLConnection httpConn, java.lang.String url)Authorizes the HTTP connection using this instance's credentials.- Parameters:
httpConn- HttpURLConnection to be authenticatedurl- String URL against which this connection should be authorized.
-
-