Interface OAuth2WebClient

  • All Superinterfaces:
    WebClient

    public interface OAuth2WebClient
    extends WebClient
    An asynchronous OAuth2/OIDC aware HTTP / HTTP/2 client called WebClientOAuth2.

    This client wraps a WebClient and makes it session aware adding features to it:

    • Request an access_token if no user is created
    • Refresh access_token if current user is expired

    • Method Detail

      • create

        static OAuth2WebClient create​(WebClient webClient,
                                      OAuth2Auth oAuth2Auth)
        Create a session aware web client using the provided webClient instance.
        Parameters:
        webClient - the web client instance
        oAuth2Auth - Configured oAuth2Auth provider to be used when withCredentials(Credentials) used
        Returns:
        the created client
      • withCredentials

        OAuth2WebClient withCredentials​(Credentials credentials)
        Mark that request should be dispatched with authentication obtained from passed OAuth2Auth provider
        Returns:
        a reference to this, so the API can be used fluently
      • addInterceptor

        OAuth2WebClient addInterceptor​(Handler<io.vertx.ext.web.client.impl.HttpContext<?>> interceptor)
        Description copied from interface: WebClient
        Add interceptor in the chain.

        The interceptor can maintain per request state with HttpContext.get(String)/HttpContext.set(String, Object).

        A request/response can be processed several times (in case of retry) and thus they should use the per request state to ensure an operation is not done twice.

        This API is internal.

        Specified by:
        addInterceptor in interface WebClient
        Parameters:
        interceptor - the interceptor to add, must not be null
        Returns:
        a reference to this, so the API can be used fluently
      • getUser

        User getUser()
        Get the authenticated user (if any) that is associated with this client.
        Returns:
        the current user associated with this client or null if no user is associated