Package io.vertx.mutiny.ext.web.handler
Class SimpleAuthenticationHandler
java.lang.Object
io.vertx.mutiny.ext.web.handler.SimpleAuthenticationHandler
- All Implemented Interfaces:
MutinyDelegate,io.vertx.core.Handler<RoutingContext>,AuthenticationHandler,Consumer<RoutingContext>
public class SimpleAuthenticationHandler
extends Object
implements AuthenticationHandler, io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>, MutinyDelegate
A user customizable authentication handler.
An auth handler allows your application to provide authentication support. The handler is not fully functional
without a authentication function. This function takes the RoutingContext as input and returns a Future.
The future should return a non null user object. In the authenticate(Function) you have full control
on the request, so all operations like redirect, next, fail are allowed. There are some rules that need to be followed
in order to allow this handler to properly interop with ChainAuthHandler.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Paulo Lopes
- See Also:
-
SimpleAuthenticationHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.ext.web.handler.AuthenticationHandler
AuthenticationHandler.AuthenticationHandlerImpl -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimpleAuthenticationHandler(io.vertx.ext.web.handler.SimpleAuthenticationHandler delegate) Create a new instance ofSimpleAuthenticationHandlerdelegating to the given (non-null) instance ofSimpleAuthenticationHandler.SimpleAuthenticationHandler(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(RoutingContext item) Handle an item.authenticate(Function<RoutingContext, io.smallrye.mutiny.Uni<User>> authenticationFunction) This function will allow you to perform authentication the way you intended to.static SimpleAuthenticationHandlercreate()Creates a new instance of the simple authentication handler.booleanio.vertx.ext.web.handler.SimpleAuthenticationHandlerGet the delegate instance.voidhandle(RoutingContext item) Handle an item.inthashCode()static SimpleAuthenticationHandlernewInstance(io.vertx.ext.web.handler.SimpleAuthenticationHandler delegate) Creates a new instance of theSimpleAuthenticationHandler.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
SimpleAuthenticationHandler
public SimpleAuthenticationHandler(io.vertx.ext.web.handler.SimpleAuthenticationHandler delegate) Create a new instance ofSimpleAuthenticationHandlerdelegating to the given (non-null) instance ofSimpleAuthenticationHandler. -
SimpleAuthenticationHandler
-
-
Method Details
-
accept
Handle an item. This method is generated from theoriginalmethod."- Specified by:
acceptin interfaceAuthenticationHandler- Specified by:
acceptin interfaceConsumer<RoutingContext>
-
handle
Handle an item. This method is generated from theoriginalmethod."- Specified by:
handlein interfaceAuthenticationHandler- Specified by:
handlein interfaceio.vertx.core.Handler<RoutingContext>
-
getDelegate
public io.vertx.ext.web.handler.SimpleAuthenticationHandler getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceAuthenticationHandler- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
create
Creates a new instance of the simple authentication handler.- Returns:
- a new instance.
-
authenticate
public SimpleAuthenticationHandler authenticate(Function<RoutingContext, io.smallrye.mutiny.Uni<User>> authenticationFunction) This function will allow you to perform authentication the way you intended to. The process should be self explanatory, for example if the request contains a given property completing the function with a nonnullUserobject is enough to allow the handler to continue. In order to signal errors, you should not callRoutingContext.fail(int)orRoutingContext.fail(Throwable). Errors should be signaled using theHttpExceptiontype. Any other kind of errors will be wrapped as a 401 error. For example forbidden access should be signaled with:new HttpException(403). This is required when working withChainAuthHandler. By using exceptions to signal failures instead of immediately terminating the request, it allows the chain to proceed to the next handler if needed.- Parameters:
authenticationFunction- the authentication function.- Returns:
- self
-
newInstance
public static SimpleAuthenticationHandler newInstance(io.vertx.ext.web.handler.SimpleAuthenticationHandler delegate) Creates a new instance of theSimpleAuthenticationHandler. -
hashCode
public int hashCode() -
equals
-
toString
-