Package io.apicurio.registry.client
Class RegistryClientOptions
java.lang.Object
io.apicurio.registry.client.RegistryClientOptions
Configuration options for creating a RegistryClient. This class encapsulates all the
configuration parameters needed to create different types of registry clients.
The options support the following authentication methods:
- Anonymous (no authentication)
- Basic authentication (username/password)
- OAuth2/OIDC authentication (client credentials)
- Custom WebClient (for advanced scenarios)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAuthentication type enumeration.static enumTrust store type enumeration for SSL/TLS configuration. -
Method Summary
Modifier and TypeMethodDescriptionConfigures basic authentication.Clears any configured trust store settings, reverting to default JVM trust store.static final RegistryClientOptionscreate()static final RegistryClientOptionsstatic final RegistryClientOptionscustomWebClient(io.vertx.ext.web.client.WebClient webClient) Configures a custom WebClient for advanced authentication scenarios.Disables retry functionality.doubleintlongString[]longgetScope()io.vertx.core.VertxgetVertx()io.vertx.ext.web.client.WebClientbooleanbooleanbooleanConfigures OAuth2/OIDC authentication using client credentials flow.Configures OAuth2/OIDC authentication using client credentials flow with scope.registryUrl(String registryUrl) Sets the registry URL.retry()Enables retry functionality with default settings (3 attempts, 1000ms initial delay, exponential backoff).retry(boolean enabled, int maxAttempts, long initialDelayMs) Configures retry functionality for HTTP requests.retry(boolean enabled, int maxAttempts, long initialDelayMs, double backoffMultiplier, long maxDelayMs) Configures retry functionality with exponential backoff for HTTP requests.trustAll(boolean trustAll) Configures the client to trust all SSL/TLS certificates without validation.trustStoreJks(String path, String password) Configures SSL/TLS with a JKS (Java KeyStore) trust store.trustStorePem(String... certPaths) Configures SSL/TLS with PEM certificate file(s).verifyHost(boolean verifyHost) Configures whether to verify the hostname in the server's certificate matches the hostname being connected to.vertx(io.vertx.core.Vertx vertx) Sets a custom Vertx instance to use.
-
Method Details
-
create
-
create
-
create
-
getRegistryUrl
-
getAuthType
-
getUsername
-
getPassword
-
getTokenEndpoint
-
getClientId
-
getClientSecret
-
getScope
-
getVertx
public io.vertx.core.Vertx getVertx() -
getWebClient
public io.vertx.ext.web.client.WebClient getWebClient() -
isRetryEnabled
public boolean isRetryEnabled() -
getMaxRetryAttempts
public int getMaxRetryAttempts() -
getRetryDelayMs
public long getRetryDelayMs() -
getBackoffMultiplier
public double getBackoffMultiplier() -
getMaxRetryDelayMs
public long getMaxRetryDelayMs() -
getTrustStoreType
-
getTrustStorePath
-
getTrustStorePassword
-
getPemCertPaths
-
isTrustAll
public boolean isTrustAll() -
isVerifyHost
public boolean isVerifyHost() -
registryUrl
Sets the registry URL.- Parameters:
registryUrl- the base URL of the registry API (e.g., "http://localhost:8080/apis/registry/v3")- Returns:
- this builder
-
basicAuth
Configures basic authentication.- Parameters:
username- the username for basic authenticationpassword- the password for basic authentication- Returns:
- this builder
-
oauth2
Configures OAuth2/OIDC authentication using client credentials flow.- Parameters:
tokenEndpoint- the OAuth2 token endpoint URLclientId- the OAuth2 client IDclientSecret- the OAuth2 client secret- Returns:
- this builder
-
oauth2
public RegistryClientOptions oauth2(String tokenEndpoint, String clientId, String clientSecret, String scope) Configures OAuth2/OIDC authentication using client credentials flow with scope.- Parameters:
tokenEndpoint- the OAuth2 token endpoint URLclientId- the OAuth2 client IDclientSecret- the OAuth2 client secretscope- the OAuth2 scope (optional, can be null)- Returns:
- this builder
-
customWebClient
Configures a custom WebClient for advanced authentication scenarios.- Parameters:
webClient- the pre-configured WebClient to use- Returns:
- this builder
-
retry
Configures retry functionality for HTTP requests.- Parameters:
enabled- whether retry functionality is enabledmaxAttempts- the maximum number of retry attempts (must be > 0 if enabled)initialDelayMs- the initial delay between retry attempts in milliseconds (must be > 0 if enabled)- Returns:
- this builder
-
retry
public RegistryClientOptions retry(boolean enabled, int maxAttempts, long initialDelayMs, double backoffMultiplier, long maxDelayMs) Configures retry functionality with exponential backoff for HTTP requests.- Parameters:
enabled- whether retry functionality is enabledmaxAttempts- the maximum number of retry attempts (must be > 0 if enabled)initialDelayMs- the initial delay between retry attempts in milliseconds (must be > 0 if enabled)backoffMultiplier- the multiplier for exponential backoff (must be > 1.0 if enabled)maxDelayMs- the maximum delay between retries in milliseconds (must be > 0 if enabled)- Returns:
- this builder
-
retry
Enables retry functionality with default settings (3 attempts, 1000ms initial delay, exponential backoff).- Returns:
- this builder
-
disableRetry
Disables retry functionality.- Returns:
- this builder
-
vertx
Sets a custom Vertx instance to use.- Parameters:
vertx- the Vertx instance to use- Returns:
- this builder
-
trustStoreJks
Configures SSL/TLS with a JKS (Java KeyStore) trust store. This allows the client to trust certificates signed by custom certificate authorities or self-signed certificates.- Parameters:
path- the path to the JKS trust store file (can be a file system path or classpath resource prefixed with "classpath:")password- the password for the trust store- Returns:
- this builder
- Throws:
IllegalArgumentException- if path is null or empty
-
trustStorePem
Configures SSL/TLS with PEM certificate file(s). This allows the client to trust certificates signed by custom certificate authorities or self-signed certificates.- Parameters:
certPaths- one or more paths to PEM certificate files (can be file system paths or classpath resources prefixed with "classpath:")- Returns:
- this builder
- Throws:
IllegalArgumentException- if no certificate paths are provided
-
trustAll
Configures the client to trust all SSL/TLS certificates without validation.WARNING: This option should ONLY be used in development or testing environments. Using this in production environments creates a serious security vulnerability as it disables certificate validation, making the connection susceptible to man-in-the-middle attacks.
- Parameters:
trustAll- if true, all certificates will be trusted without validation- Returns:
- this builder
-
verifyHost
Configures whether to verify the hostname in the server's certificate matches the hostname being connected to. By default, hostname verification is enabled.WARNING: Disabling hostname verification reduces security and should only be done in development or testing environments.
- Parameters:
verifyHost- if true, hostname verification will be performed (default); if false, it will be disabled- Returns:
- this builder
-
clearTrustStore
Clears any configured trust store settings, reverting to default JVM trust store.- Returns:
- this builder
-