Package io.quarkus.vertx.http.security
Class MTLS.Builder
java.lang.Object
io.quarkus.vertx.http.security.MTLS.Builder
- Enclosing interface:
MTLS
The mutual TLS client authentication mechanism builder.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthentication(io.vertx.core.http.ClientAuth clientAuthentication) When the mutual TLS client authentication is configured with this builder, the client authentication isClientAuth.REQUIREDfor all requests by default.build()certificateAttribute(String certificateAttribute) Selects a certificate attribute which values are mapped to theSecurityIdentityroles.certificateToRolesMapper(Function<X509Certificate, Set<String>> certificateToRolesMapper) Check the values of different client certificate attributes and map them to theSecurityIdentityroles.rolesMapping(String certificateAttributeValue, String... roles) This is a shortcut method forrolesMapping(String, Set.of(roles)).rolesMapping(String certificateAttributeValue, Set<String> roles) Adds a certificate attribute value to roles mapping.Configures the name of the TLS configuration used by the HTTP server for the TLS communication.Registers a TLS configuration into the registry and configures the TLS configuration used by the HTTP server for the TLS communication.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
tls
Configures the name of the TLS configuration used by the HTTP server for the TLS communication. Please note that this method is mutually exclusive with the 'quarkus.http.tls-configuration-name' configuration property.- Parameters:
tlsConfigurationName- the name of the configuration, cannot be<default>- Returns:
- Builder
- See Also:
-
tls
public MTLS.Builder tls(String tlsConfigurationName, io.quarkus.tls.TlsConfiguration tlsConfiguration) Registers a TLS configuration into the registry and configures the TLS configuration used by the HTTP server for the TLS communication. Please note that this method is mutually exclusive with the 'quarkus.http.tls-configuration-name' configuration property and if the configuration with this name is already registered in the TLS registry, validation will fail.The passed TLS configuration is not validated, so it's up to the caller to ensure the configuration is correct.
- Parameters:
tlsConfigurationName- the name of the configuration, cannot benull, cannot be<default>tlsConfiguration- the configuration cannot benull- Returns:
- Builder
- See Also:
-
authentication
When the mutual TLS client authentication is configured with this builder, the client authentication isClientAuth.REQUIREDfor all requests by default. If you configureClientAuth.REQUEST, the client authentication is accepted if presented by a client. Use theClientAuth.REQUESToption if the client authentication is only required for certain routes and secure these routes with HTTP permissions or standard security annotations.- Parameters:
clientAuthentication-ClientAuth.REQUESTorClientAuth.REQUIRED- Returns:
- Builder
- See Also:
-
certificateAttribute
Selects a certificate attribute which values are mapped to theSecurityIdentityroles. This attribute will be used for mappings added with therolesMapping(String, Set)method. The default attribute value is configured to the default value of theAuthRuntimeConfig.certificateRoleAttribute()configuration property.- Parameters:
certificateAttribute- certificate attribute; seeAuthRuntimeConfig.certificateRoleAttribute()for information about supported values- Returns:
- CertificateRolesBuilder
-
rolesMapping
This is a shortcut method forrolesMapping(String, Set.of(roles)).- Returns:
- Builder
- See Also:
-
rolesMapping
Adds a certificate attribute value to roles mapping. The certificate attribute itself can be configured with thecertificateAttributemethod.- Parameters:
certificateAttributeValue-AuthRuntimeConfig.certificateRoleAttribute()values that will be mapped to theSecurityIdentityrolesroles-SecurityIdentity.getRoles()- Returns:
- CertificateRolesBuilder
-
certificateToRolesMapper
public MTLS.Builder certificateToRolesMapper(Function<X509Certificate, Set<String>> certificateToRolesMapper) Check the values of different client certificate attributes and map them to theSecurityIdentityroles.- Parameters:
certificateToRolesMapper- a client certificate to theSecurityIdentityroles mapper- Returns:
- Builder
-
build
- Returns:
- MtlsAuthenticationMechanism that can be registered
with the
HttpSecurity.mTLS(MtlsAuthenticationMechanism)method.
-