Class LoginController


  • @Requires(property="micronaut.security.endpoints.login.enabled",
              value="true")
    @Controller("${micronaut.security.endpoints.login.path:/login}")
    @Secured("isAnonymous()")
    @Validated
    public class LoginController
    extends java.lang.Object
    Handles login requests.
    Since:
    1.0
    Author:
    Sergio del Amo, Graeme Rocher
    • 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
        public io.reactivex.Single<io.micronaut.http.HttpResponse> 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