Class HttpAuthenticator
java.lang.Object
io.quarkus.vertx.http.runtime.security.HttpAuthenticator
Class that is responsible for running the HTTP based authentication
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhetherBasicAuthenticationhas been detected, which means that user needs to use basic authentication.static final StringSpecial handling for the basic authentication mechanism, for user convenience, we add the mechanism when: - not explicitly disabled or enabled - is default bean and not programmatically looked up because there are other authentication mechanisms - no custom auth mechanism is defined because then, we can't tell if user didn't provide custom impl. -
Constructor Summary
ConstructorsConstructorDescriptionHttpAuthenticator(io.quarkus.security.identity.IdentityProviderManager identityProviderManager, jakarta.enterprise.event.Event<AuthenticationFailureEvent> authFailureEvent, jakarta.enterprise.event.Event<AuthenticationSuccessEvent> authSuccessEvent, jakarta.enterprise.inject.spi.BeanManager beanManager, HttpBuildTimeConfig httpBuildTimeConfig, jakarta.enterprise.inject.Instance<HttpAuthenticationMechanism> httpAuthenticationMechanism, jakarta.enterprise.inject.Instance<io.quarkus.security.identity.IdentityProvider<?>> providers, boolean securityEventsEnabled) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity>attemptAuthentication(io.vertx.ext.web.RoutingContext routingContext) Attempts authentication with the contents of the request.io.smallrye.mutiny.Uni<ChallengeData>getChallenge(io.vertx.ext.web.RoutingContext routingContext) io.quarkus.security.identity.IdentityProviderManager(package private) static voidselectAuthMechanism(io.vertx.ext.web.RoutingContext routingContext, String authMechanism) (package private) static voidio.smallrye.mutiny.Uni<Boolean>sendChallenge(io.vertx.ext.web.RoutingContext routingContext)
-
Field Details
-
TEST_IF_BASIC_AUTH_IMPLICITLY_REQUIRED
Special handling for the basic authentication mechanism, for user convenience, we add the mechanism when: - not explicitly disabled or enabled - is default bean and not programmatically looked up because there are other authentication mechanisms - no custom auth mechanism is defined because then, we can't tell if user didn't provide custom impl. - there is a provider that supports it (if not, we inform user via the log)Presence of this system property means that we need to test whether: - there are HTTP Permissions using explicitly this mechanism - or
BasicAuthentication- See Also:
-
BASIC_AUTH_ANNOTATION_DETECTED
WhetherBasicAuthenticationhas been detected, which means that user needs to use basic authentication. Only set when detected andTEST_IF_BASIC_AUTH_IMPLICITLY_REQUIREDis true.- See Also:
-
-
Constructor Details
-
HttpAuthenticator
public HttpAuthenticator(io.quarkus.security.identity.IdentityProviderManager identityProviderManager, jakarta.enterprise.event.Event<AuthenticationFailureEvent> authFailureEvent, jakarta.enterprise.event.Event<AuthenticationSuccessEvent> authSuccessEvent, jakarta.enterprise.inject.spi.BeanManager beanManager, HttpBuildTimeConfig httpBuildTimeConfig, jakarta.enterprise.inject.Instance<HttpAuthenticationMechanism> httpAuthenticationMechanism, jakarta.enterprise.inject.Instance<io.quarkus.security.identity.IdentityProvider<?>> providers, boolean securityEventsEnabled)
-
-
Method Details
-
getIdentityProviderManager
public io.quarkus.security.identity.IdentityProviderManager getIdentityProviderManager() -
attemptAuthentication
public io.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> attemptAuthentication(io.vertx.ext.web.RoutingContext routingContext) Attempts authentication with the contents of the request. If this is possible the Uni will resolve to a valid SecurityIdentity when it is subscribed to. Note that Uni is lazy, so this may not happen until the Uni is subscribed to.If invalid credentials are present then the completion stage will resolve to a
AuthenticationFailedExceptionIf no credentials are present it will resolve to null.
-
sendChallenge
public io.smallrye.mutiny.Uni<Boolean> sendChallenge(io.vertx.ext.web.RoutingContext routingContext) - Returns:
-
getChallenge
public io.smallrye.mutiny.Uni<ChallengeData> getChallenge(io.vertx.ext.web.RoutingContext routingContext) -
selectAuthMechanismWithAnnotation
static void selectAuthMechanismWithAnnotation() -
selectAuthMechanism
static void selectAuthMechanism(io.vertx.ext.web.RoutingContext routingContext, String authMechanism)
-