Class MockAuthenticationProvider<T,I,S>

java.lang.Object
io.micronaut.security.testutils.authprovider.MockAuthenticationProvider<T,I,S>
All Implemented Interfaces:
io.micronaut.core.order.Ordered, ReactiveAuthenticationProvider<T,I,S>

public class MockAuthenticationProvider<T,I,S> extends Object implements ReactiveAuthenticationProvider<T,I,S>
Utility class to mock authentication scenarios.
  • Constructor Details

    • MockAuthenticationProvider

      public MockAuthenticationProvider(List<SuccessAuthenticationScenario> successAuthenticationScenarioList)
      Parameters:
      successAuthenticationScenarioList - Successful scenarios
    • MockAuthenticationProvider

      public MockAuthenticationProvider(List<SuccessAuthenticationScenario> successAuthenticationScenarioList, List<FailedAuthenticationScenario> failedAuthenticationScenarioList)
      Parameters:
      successAuthenticationScenarioList - Successful scenarios
      failedAuthenticationScenarioList - Failure scenarios
  • Method Details

    • authenticate

      public org.reactivestreams.Publisher<AuthenticationResponse> authenticate(T requestContext, AuthenticationRequest<I,S> authenticationRequest)
      Description copied from interface: ReactiveAuthenticationProvider
      Authenticates a user with the given request. If a successful authentication is returned, the object must be an instance of Authentication. Publishers MUST emit cold observables! This method will be called for all authenticators for each authentication request and it is assumed no work will be done until the publisher is subscribed to.
      Specified by:
      authenticate in interface ReactiveAuthenticationProvider<T,I,S>
      Parameters:
      requestContext - rquest context (it may be an HTTP request).
      authenticationRequest - The credentials to authenticate
      Returns:
      A publisher that emits 0 or 1 responses