Class OAuth2TestTokenImpl
- java.lang.Object
-
- com.boomi.connector.testutil.auth.OAuth2TestTokenImpl
-
- All Implemented Interfaces:
OAuth2Token
public class OAuth2TestTokenImpl extends Object implements OAuth2Token
BaseOAuth2Tokenimplementation This implementation of Oauth2Token is be used by connector tests to perform oauth2 authentication
-
-
Constructor Summary
Constructors Constructor Description OAuth2TestTokenImpl(OAuth2TestContextImpl context)Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateAccessTokenRequestHeaderValue(HttpURLConnection httpURLConnection)Gets the formatted HTTP Authorization Header value for the OAuth 2.0 Access Token.StringgetAccessToken()Get the OAuth 2.0 access token stringStringgetAccessTokenType()Get the OAuth 2.0 Access Token type.OAuth2ContextgetOAuth2Context()Convenience method to get the OAuth2Context from the OAuth2TokenStringgetProperty(String key)Get a property from the OAuth 2.0 Access Token responsevoidrefreshToken()Refreshes the access token in case of force update This is a POST request for a new access token using the refresh token.
-
-
-
Constructor Detail
-
OAuth2TestTokenImpl
public OAuth2TestTokenImpl(OAuth2TestContextImpl context)
Creates a new instance- Parameters:
context- the OAuth2TestContextImpl for OAuth authentication
-
-
Method Detail
-
getAccessToken
public String getAccessToken()
Get the OAuth 2.0 access token string This method will callrefreshToken()if the Access Token hasn't been requested yet- Specified by:
getAccessTokenin interfaceOAuth2Token- Returns:
- String access token
-
getAccessTokenType
public String getAccessTokenType()
Get the OAuth 2.0 Access Token type. Possible values are bearer and mac This method will callrefreshToken()if the Access Token hasn't been requested yet- Specified by:
getAccessTokenTypein interfaceOAuth2Token- Returns:
- String access token type
-
createAccessTokenRequestHeaderValue
public String createAccessTokenRequestHeaderValue(HttpURLConnection httpURLConnection) throws IOException
Description copied from interface:OAuth2TokenGets the formatted HTTP Authorization Header value for the OAuth 2.0 Access Token. Will return bearer or mac access token headers based on the value of the access token type.- Specified by:
createAccessTokenRequestHeaderValuein interfaceOAuth2Token- Parameters:
httpURLConnection- HttpURLConnection (not used for bearer tokens. required for mac tokens- Returns:
- String Authorization header value
- Throws:
IOException
-
getOAuth2Context
public OAuth2Context getOAuth2Context()
Description copied from interface:OAuth2TokenConvenience method to get the OAuth2Context from the OAuth2Token- Specified by:
getOAuth2Contextin interfaceOAuth2Token- Returns:
- OAuth2Context
-
getProperty
public String getProperty(String key)
Get a property from the OAuth 2.0 Access Token response This method will callrefreshToken()if the Access Token hasn't been requested yet- Specified by:
getPropertyin interfaceOAuth2Token- Parameters:
key- the property you would like to retrieve- Returns:
- String the property value
-
refreshToken
public void refreshToken()
Refreshes the access token in case of force update This is a POST request for a new access token using the refresh token.
-
-