Package io.micronaut.security.endpoints
Class LoginController
- java.lang.Object
-
- io.micronaut.security.endpoints.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 Summary
Fields Modifier and Type Field Description protected Authenticator
authenticator
protected io.micronaut.context.event.ApplicationEventPublisher
eventPublisher
protected LoginHandler
loginHandler
-
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 io.reactivex.Single<io.micronaut.http.HttpResponse>
login(@Valid UsernamePasswordCredentials usernamePasswordCredentials, io.micronaut.http.HttpRequest<?> request)
-
-
-
Field Detail
-
authenticator
protected final Authenticator authenticator
-
loginHandler
protected final LoginHandler loginHandler
-
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
collaboratorloginHandler
- 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 ofUsernamePasswordCredentials
in the body payloadrequest
- TheHttpRequest
being executed- Returns:
- An AccessRefreshToken encapsulated in the HttpResponse or a failure indicated by the HTTP status
-
-