Class RegistryClientOptions

java.lang.Object
io.apicurio.registry.client.RegistryClientOptions

public class RegistryClientOptions extends Object
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)
  • Method Details

    • create

      public static final RegistryClientOptions create()
    • create

      public static final RegistryClientOptions create(String registryUrl)
    • create

      public static final RegistryClientOptions create(String registryUrl, io.vertx.core.Vertx vertx)
    • getRegistryUrl

      public String getRegistryUrl()
    • getAuthType

      public RegistryClientOptions.AuthType getAuthType()
    • getUsername

      public String getUsername()
    • getPassword

      public String getPassword()
    • getTokenEndpoint

      public String getTokenEndpoint()
    • getClientId

      public String getClientId()
    • getClientSecret

      public String getClientSecret()
    • getScope

      public String 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

      public RegistryClientOptions.TrustStoreType getTrustStoreType()
    • getTrustStorePath

      public String getTrustStorePath()
    • getTrustStorePassword

      public String getTrustStorePassword()
    • getPemCertPaths

      public String[] getPemCertPaths()
    • isTrustAll

      public boolean isTrustAll()
    • isVerifyHost

      public boolean isVerifyHost()
    • registryUrl

      public RegistryClientOptions registryUrl(String 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

      public RegistryClientOptions basicAuth(String username, String password)
      Configures basic authentication.
      Parameters:
      username - the username for basic authentication
      password - the password for basic authentication
      Returns:
      this builder
    • oauth2

      public RegistryClientOptions oauth2(String tokenEndpoint, String clientId, String clientSecret)
      Configures OAuth2/OIDC authentication using client credentials flow.
      Parameters:
      tokenEndpoint - the OAuth2 token endpoint URL
      clientId - the OAuth2 client ID
      clientSecret - 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 URL
      clientId - the OAuth2 client ID
      clientSecret - the OAuth2 client secret
      scope - the OAuth2 scope (optional, can be null)
      Returns:
      this builder
    • customWebClient

      public RegistryClientOptions customWebClient(io.vertx.ext.web.client.WebClient webClient)
      Configures a custom WebClient for advanced authentication scenarios.
      Parameters:
      webClient - the pre-configured WebClient to use
      Returns:
      this builder
    • retry

      public RegistryClientOptions retry(boolean enabled, int maxAttempts, long initialDelayMs)
      Configures retry functionality for HTTP requests.
      Parameters:
      enabled - whether retry functionality is enabled
      maxAttempts - 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 enabled
      maxAttempts - 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

      public RegistryClientOptions retry()
      Enables retry functionality with default settings (3 attempts, 1000ms initial delay, exponential backoff).
      Returns:
      this builder
    • disableRetry

      public RegistryClientOptions disableRetry()
      Disables retry functionality.
      Returns:
      this builder
    • vertx

      public RegistryClientOptions vertx(io.vertx.core.Vertx vertx)
      Sets a custom Vertx instance to use.
      Parameters:
      vertx - the Vertx instance to use
      Returns:
      this builder
    • trustStoreJks

      public RegistryClientOptions trustStoreJks(String path, String password)
      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

      public RegistryClientOptions trustStorePem(String... certPaths)
      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

      public RegistryClientOptions trustAll(boolean 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

      public RegistryClientOptions verifyHost(boolean 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

      public RegistryClientOptions clearTrustStore()
      Clears any configured trust store settings, reverting to default JVM trust store.
      Returns:
      this builder