Interface OauthClient

  • All Known Subinterfaces:
    OpenIdClient
    All Known Implementing Classes:
    DefaultOauthClient, DefaultOpenIdClient

    public interface OauthClient
    A contract for an OAuth 2.0 client. This interface is the base class necessary for implementing OAuth 2.0 authorization code grant behavior. Given how generic the contract is, any pattern that relies on a redirect and a callback can be implemented with the contract. It could be used for implementing authentication with non standard or non supported standard providers, including OAuth 1.0. Those types of usages are not supported by this API and future major revisions may break their functionality. The client implementations are called through the OauthController. A controller is created for each client bean and routes for the controller are registered in a route builder.
    Since:
    1.2.0
    Author:
    James Kleeh
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.reactivestreams.Publisher<io.micronaut.http.HttpResponse> authorizationRedirect​(io.micronaut.http.HttpRequest originating)
      Responsible for redirecting to the authorization endpoint.
      java.lang.String getName()  
      org.reactivestreams.Publisher<AuthenticationResponse> onCallback​(io.micronaut.http.HttpRequest<java.util.Map<java.lang.String,​java.lang.Object>> request)
      Responsible for receiving the authorization callback request and returning an authentication response.
    • Method Detail

      • getName

        java.lang.String getName()
        Returns:
        The provider name
      • authorizationRedirect

        org.reactivestreams.Publisher<io.micronaut.http.HttpResponse> authorizationRedirect​(io.micronaut.http.HttpRequest originating)
        Responsible for redirecting to the authorization endpoint.
        Parameters:
        originating - The originating request
        Returns:
        A response publisher
      • onCallback

        org.reactivestreams.Publisher<AuthenticationResponse> onCallback​(io.micronaut.http.HttpRequest<java.util.Map<java.lang.String,​java.lang.Object>> request)
        Responsible for receiving the authorization callback request and returning an authentication response.
        Parameters:
        request - The callback request
        Returns:
        The authentication response