Class OAuth2TestTokenImpl

  • All Implemented Interfaces:
    OAuth2Token

    public class OAuth2TestTokenImpl
    extends Object
    implements OAuth2Token
    Base OAuth2Token implementation This implementation of Oauth2Token is be used by connector tests to perform oauth2 authentication
    • 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 call refreshToken() if the Access Token hasn't been requested yet
        Specified by:
        getAccessToken in interface OAuth2Token
        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 call refreshToken() if the Access Token hasn't been requested yet
        Specified by:
        getAccessTokenType in interface OAuth2Token
        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 interface OAuth2Token
        Parameters:
        httpURLConnection - HttpURLConnection (not used for bearer tokens. required for mac tokens
        Returns:
        String Authorization header value
        Throws:
        IOException
      • getProperty

        public String getProperty​(String key)
        Get a property from the OAuth 2.0 Access Token response This method will call refreshToken() if the Access Token hasn't been requested yet
        Specified by:
        getProperty in interface OAuth2Token
        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.