Class OAuth2TestContextImpl

  • All Implemented Interfaces:
    OAuth2Context

    public class OAuth2TestContextImpl
    extends Object
    implements OAuth2Context
    Base OAuth2Context implementation This test context implementation should be added as a connection property to test context
    • Constructor Detail

      • OAuth2TestContextImpl

        public OAuth2TestContextImpl​(OAuth2TestConfig config)
        Creates a new instance
        Parameters:
        config - the OAuth2TestConfig for OAuth authentication
    • Method Detail

      • getAuthorizationTokenUrl

        public String getAuthorizationTokenUrl()
        Description copied from interface: OAuth2Context
        Get the OAuth 2.0 Authorization Token URL The authorization token url is used retrieve the authorization code.
        Specified by:
        getAuthorizationTokenUrl in interface OAuth2Context
        Returns:
        String authorization token url
      • getAccessTokenUrl

        public String getAccessTokenUrl()
        Description copied from interface: OAuth2Context
        Get the OAuth 2.0 Access Token URL The Access Token URL is used when retrieving new access and refresh tokens.
        Specified by:
        getAccessTokenUrl in interface OAuth2Context
        Returns:
        String access token url
      • isUseRefreshToken

        public boolean isUseRefreshToken()
        Description copied from interface: OAuth2Context
        Indicates if this OAuth 2.0 configuration uses refresh tokens
        Specified by:
        isUseRefreshToken in interface OAuth2Context
        Returns:
        boolean true if refresh tokens are used.
      • getAuthorizationParameters

        public Map<String,​String> getAuthorizationParameters()
        Description copied from interface: OAuth2Context
        Gets a map of any additional OAuth 2.0 authorization parameters These parameters are used when retrieving the authorization code during the initial access token retrieval
        Specified by:
        getAuthorizationParameters in interface OAuth2Context
        Returns:
        Map<String, String> parameter name, parameter value
      • getAccessTokenParameters

        public Map<String,​String> getAccessTokenParameters()
        Description copied from interface: OAuth2Context
        Gets a map of any additional OAuth 2.0 access token parameters These parameters are used when retrieving the access token during the initial access token retrieval
        Specified by:
        getAccessTokenParameters in interface OAuth2Context
        Returns:
        Map<String, String> parameter name, parameter value
      • getRefreshToken

        public String getRefreshToken()
        Returns the refresh token as provided in config
        Returns:
        the refresh token
      • getOAuth2Token

        public OAuth2Token getOAuth2Token​(boolean forceUpdate)
                                   throws IOException
        Retrieves the OAuth2Token. this test method implementation will refresh the access token using the refresh token if force update is true or access token is null.
        Specified by:
        getOAuth2Token in interface OAuth2Context
        Parameters:
        forceUpdate - boolean. If true, will force update of OAuth 2.0 token.
        Returns:
        the oauth2 token with a access token
        Throws:
        IOException