Class LoginController


  • @Requires(property="micronaut.security.endpoints.login.enabled",notEquals="false",defaultValue="true") @Requires(beans=LoginHandler.class) @Requires(beans=Authenticator.class)
    @Controller("${micronaut.security.endpoints.login.path:/login}")
    @Secured("isAnonymous()")
    @Validated
    public class LoginController
    extends java.lang.Object
    Handles login requests.
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      LoginController​(Authenticator authenticator, LoginHandler loginHandler, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> login​(@Valid UsernamePasswordCredentials usernamePasswordCredentials, io.micronaut.http.HttpRequest<?> request)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • eventPublisher

        protected final io.micronaut.context.event.ApplicationEventPublisher eventPublisher
    • Constructor Detail

      • LoginController

        public LoginController​(Authenticator authenticator,
                               LoginHandler loginHandler,
                               io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
        Parameters:
        authenticator - Authenticator collaborator
        loginHandler - A collaborator which helps to build HTTP response depending on success or failure.
        eventPublisher - The application event publisher
    • Method Detail

      • 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<?> 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