All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.tls.runtime.config.TrustStoreConfig Maven / Gradle / Ivy

There is a newer version: 3.17.0
Show newest version
package io.quarkus.tls.runtime.config;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigGroup;

@ConfigGroup
public interface TrustStoreConfig {

    /**
     * Configures the list of trusted certificates.
     */
    Optional pem();

    /**
     * Configure the PKCS12 trust store.
     */
    Optional p12();

    /**
     * Configure the JKS trust store.
     */
    Optional jks();

    /**
     * The credential provider configuration for the trust store.
     * A credential provider offers a way to retrieve the trust store password.
     * Note that the credential provider is only used if the password is not set in the configuration.
     */
    TrustStoreCredentialProviderConfig credentialsProvider();

    default void validate(String name) {
        if (pem().isPresent() && (p12().isPresent() || jks().isPresent())) {
            throw new IllegalStateException(
                    "Invalid truststore '" + name
                            + "' - The truststore cannot be configured with PEM and PKCS12 or JKS at the same time");
        }

        if (p12().isPresent() && jks().isPresent()) {
            throw new IllegalStateException(
                    "Invalid truststore '" + name
                            + "' - The truststore cannot be configured with PKCS12 and JKS at the same time");
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy