Class CodeFlowAuthTokenAPIHandler

    • Field Detail

      • redirectURI

        protected final java.lang.String redirectURI
      • scope

        protected final java.lang.String scope
      • code

        protected java.lang.String code
      • state

        protected java.lang.String state
    • Method Detail

      • getAuthorizeURI

        public java.net.URI getAuthorizeURI()
                                     throws HiroException,
                                            java.io.IOException,
                                            java.lang.InterruptedException
        Generate a URI for a browser to use for the authorization call. This call will be answered with a redirection to a login page.
        Returns:
        The URI for a login page.
        Throws:
        java.io.IOException - On a failed call to /api/version
        java.lang.InterruptedException - Call got interrupted
        HiroException - When calling /api/version responds with an error
      • handleAuthorizeCallback

        public void handleAuthorizeCallback​(java.lang.String state,
                                            java.lang.String code)
                                     throws AuthenticationTokenException
        Handle authorization callback data.
        Parameters:
        state - The state returned by the callback. Must not have changed.
        code - The one-time-code returned (used to obtain a full authorization token).
        Throws:
        AuthenticationTokenException - When the state of the callback does not match the internal state.
      • requestToken

        protected void requestToken​(java.lang.String organization,
                                    java.lang.String organizationId)
                             throws java.io.IOException,
                                    java.lang.InterruptedException,
                                    HiroException
        Obtain a new token from the auth API.
        Specified by:
        requestToken in class AbstractRemoteAuthTokenAPIHandler
        Parameters:
        organization - : Optional organization name. May be null.
        organizationId - : Optional organization id. May be null.
        Throws:
        java.lang.InterruptedException - When call gets interrupted.
        java.io.IOException - When call has IO errors.
        HiroException - On Hiro protocol / handling errors.
        TokenUnauthorizedException - When code is blank, i.e. the code has never been submitted via handleAuthorizeCallback(String state, String code) or has already been used.