Class LoginController<B>

java.lang.Object
io.micronaut.security.endpoints.LoginController<B>
Type Parameters:
B - The HTTP Request Body type

@Requires(property="micronaut.security.endpoints.login.enabled",notEquals="false",defaultValue="true") @Requires(classes=io.micronaut.http.annotation.Controller.class) @Requires(beans={LoginHandler.class,Authenticator.class}) @Controller("${micronaut.security.endpoints.login.path:/login}") @Secured("isAnonymous()") public class LoginController<B> extends Object
Handles login requests.
Since:
1.0
Author:
Sergio del Amo, Graeme Rocher
  • Field Details

    • authenticator

      protected final Authenticator<io.micronaut.http.HttpRequest<B>> authenticator
    • loginHandler

      protected final LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>> loginHandler
    • loginSuccessfulEventPublisher

      protected final io.micronaut.context.event.ApplicationEventPublisher<LoginSuccessfulEvent> loginSuccessfulEventPublisher
    • loginFailedEventPublisher

      protected final io.micronaut.context.event.ApplicationEventPublisher<LoginFailedEvent> loginFailedEventPublisher
    • httpHostResolver

      protected final io.micronaut.http.server.util.HttpHostResolver httpHostResolver
    • httpLocaleResolver

      protected final io.micronaut.http.server.util.locale.HttpLocaleResolver httpLocaleResolver
  • Constructor Details

    • LoginController

      @Inject public LoginController(Authenticator<io.micronaut.http.HttpRequest<B>> authenticator, LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>> loginHandler, io.micronaut.context.event.ApplicationEventPublisher<LoginSuccessfulEvent> loginSuccessfulEventPublisher, io.micronaut.context.event.ApplicationEventPublisher<LoginFailedEvent> loginFailedEventPublisher, io.micronaut.http.server.util.HttpHostResolver httpHostResolver, io.micronaut.http.server.util.locale.HttpLocaleResolver httpLocaleResolver)
      Parameters:
      authenticator - Authenticator collaborator
      loginHandler - A collaborator which helps to build HTTP response depending on success or failure.
      loginSuccessfulEventPublisher - Application event publisher for LoginSuccessfulEvent.
      loginFailedEventPublisher - Application event publisher for LoginFailedEvent.
      httpHostResolver - The http host resolver
      httpLocaleResolver - The http locale resolver
      Since:
      4.7.0
    • LoginController

      @Deprecated(forRemoval=true, since="4.7.0") public LoginController(Authenticator<io.micronaut.http.HttpRequest<B>> authenticator, LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>> loginHandler, io.micronaut.context.event.ApplicationEventPublisher<LoginSuccessfulEvent> loginSuccessfulEventPublisher, io.micronaut.context.event.ApplicationEventPublisher<LoginFailedEvent> loginFailedEventPublisher)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      authenticator - Authenticator collaborator
      loginHandler - A collaborator which helps to build HTTP response depending on success or failure.
      loginSuccessfulEventPublisher - Application event publisher for LoginSuccessfulEvent.
      loginFailedEventPublisher - Application event publisher for LoginFailedEvent.
  • Method Details

    • login

      @Consumes({"application/x-www-form-urlencoded","application/json"}) @Post @SingleResult public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> login(@Valid @Body @Valid UsernamePasswordCredentials usernamePasswordCredentials, io.micronaut.http.HttpRequest<B> request)
      Parameters:
      usernamePasswordCredentials - An instance of UsernamePasswordCredentials in the body payload
      request - The HttpRequest being executed
      Returns:
      An AccessRefreshToken encapsulated in the HttpResponse or a failure indicated by the HTTP status