Class LoginActionHandler<A extends LoginCredentials,B extends Authentication,C extends ExchangeContext,D extends Exchange<C>>
- Type Parameters:
A- the login credentials typeB- the authentication typeC- the context typeD- the exchange type
- All Implemented Interfaces:
ExchangeHandler<C,,D> ReactiveExchangeHandler<C,D>
An exchange handler that authenticates login credentials and delegates further processing to success and failure handlers.
A login action handler is typically used in a form login authentication to authenticate the credentials sent by a user in a POST request.
It relies on a CredentialsExtractor to extract login credentials from the request, an Authenticator to authenticate them, a LoginSuccessHandler and a
LoginFailureHandler to respectively handle successful authentications and failed authentications.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Constructor Summary
ConstructorsConstructorDescriptionLoginActionHandler(CredentialsExtractor<A, C, D> credentialsExtractor, Authenticator<A, B> authenticator) Creates a login action handler with the specified credentials extractor and authenticator.LoginActionHandler(CredentialsExtractor<A, C, D> credentialsExtractor, Authenticator<A, B> authenticator, LoginSuccessHandler<B, C, D> loginSuccessHandler, LoginFailureHandler<C, D> loginFailureHandler) Creates a login action handler with the specified credentials extractor, authenticator, login success handler and login failure handler. -
Method Summary
Modifier and TypeMethodDescriptionBy default, returns a Mono that defers the execution ofExchangeHandler.handle(io.inverno.mod.http.server.Exchange).Returns the authenticator.Returns the credentials extractor.Returns the login failure handler.Returns the login success handler.voidProcesses the specified server exchange.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.http.server.ReactiveExchangeHandler
intercept
-
Constructor Details
-
LoginActionHandler
public LoginActionHandler(CredentialsExtractor<A, C, D> credentialsExtractor, Authenticator<A, B> authenticator) Creates a login action handler with the specified credentials extractor and authenticator.
- Parameters:
credentialsExtractor- a credentials extractorauthenticator- an authenticator
-
LoginActionHandler
public LoginActionHandler(CredentialsExtractor<A, C, D> credentialsExtractor, Authenticator<A, B> authenticator, LoginSuccessHandler<B, C, D> loginSuccessHandler, LoginFailureHandler<C, D> loginFailureHandler) Creates a login action handler with the specified credentials extractor, authenticator, login success handler and login failure handler.
- Parameters:
credentialsExtractor- a credentials extractorauthenticator- an authenticatorloginSuccessHandler- a login success handlerloginFailureHandler- a login failure handler
-
-
Method Details
-
getCredentialsExtractor
Returns the credentials extractor.
- Returns:
- the credentials extractor
-
getAuthenticator
Returns the authenticator.
- Returns:
- the authenticator
-
getLoginSuccessHandler
Returns the login success handler.
- Returns:
- the login success handler
-
getLoginFailureHandler
Returns the login failure handler.
- Returns:
- the login failure handler
-
defer
Description copied from interface:ExchangeHandlerBy default, returns a Mono that defers the execution of
ExchangeHandler.handle(io.inverno.mod.http.server.Exchange).- Specified by:
deferin interfaceExchangeHandler<A extends LoginCredentials,B extends Authentication> - Specified by:
deferin interfaceReactiveExchangeHandler<A extends LoginCredentials,B extends Authentication> - Parameters:
exchange- the exchange to process- Returns:
- an empty mono that completes when the exchange has been processed
-
handle
Description copied from interface:ExchangeHandlerProcesses the specified server exchange.
This method is more convenient than
ExchangeHandler.defer(io.inverno.mod.http.server.Exchange)when the handling logic does not need to be reactive.- Specified by:
handlein interfaceExchangeHandler<A extends LoginCredentials,B extends Authentication> - Parameters:
exchange- the exchange to process- Throws:
HttpException- if an error occurs during the processing of the exchange
-