Class OAuth2TestTokenImpl
- java.lang.Object
-
- com.boomi.connector.testutil.auth.OAuth2TestTokenImpl
-
- All Implemented Interfaces:
OAuth2Token
public class OAuth2TestTokenImpl extends Object implements OAuth2Token
BaseOAuth2Token
implementation 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 String
createAccessTokenRequestHeaderValue(HttpURLConnection httpURLConnection)
Gets the formatted HTTP Authorization Header value for the OAuth 2.0 Access Token.String
getAccessToken()
Get the OAuth 2.0 access token stringString
getAccessTokenType()
Get the OAuth 2.0 Access Token type.OAuth2Context
getOAuth2Context()
Convenience method to get the OAuth2Context from the OAuth2TokenString
getProperty(String key)
Get a property from the OAuth 2.0 Access Token responsevoid
refreshToken()
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:
getAccessToken
in 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:
getAccessTokenType
in interfaceOAuth2Token
- Returns:
- String access token type
-
createAccessTokenRequestHeaderValue
public String createAccessTokenRequestHeaderValue(HttpURLConnection httpURLConnection) throws IOException
Description copied from interface:OAuth2Token
Gets 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:
createAccessTokenRequestHeaderValue
in 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:OAuth2Token
Convenience method to get the OAuth2Context from the OAuth2Token- Specified by:
getOAuth2Context
in 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:
getProperty
in 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.
-
-