@Requires(property="micronaut.security.endpoints.login.enabled",notEquals="false",defaultValue="true") @Requires(beans=LoginHandler.class) @Requires(beans=Authenticator.class) @Controller(value="${micronaut.security.endpoints.login.path:/login}") @Secured(value="isAnonymous()") @Validated public class LoginController extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Authenticator |
authenticator |
protected io.micronaut.context.event.ApplicationEventPublisher |
eventPublisher |
protected LoginHandler |
loginHandler |
Constructor and Description |
---|
LoginController(Authenticator authenticator,
LoginHandler loginHandler,
io.micronaut.context.event.ApplicationEventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
io.reactivex.Single<io.micronaut.http.MutableHttpResponse<?>> |
login(@Valid UsernamePasswordCredentials usernamePasswordCredentials,
io.micronaut.http.HttpRequest<?> request) |
protected final Authenticator authenticator
protected final LoginHandler loginHandler
protected final io.micronaut.context.event.ApplicationEventPublisher eventPublisher
public LoginController(Authenticator authenticator, LoginHandler loginHandler, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
authenticator
- Authenticator
collaboratorloginHandler
- A collaborator which helps to build HTTP response depending on success or failure.eventPublisher
- The application event publisher@Consumes(value={"application/x-www-form-urlencoded","application/json"}) @Post public io.reactivex.Single<io.micronaut.http.MutableHttpResponse<?>> login(@Valid @Body @Valid UsernamePasswordCredentials usernamePasswordCredentials, io.micronaut.http.HttpRequest<?> request)
usernamePasswordCredentials
- An instance of UsernamePasswordCredentials
in the body payloadrequest
- The HttpRequest
being executed