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

io.vertx.core.net.TrustOptions Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
/*
 * Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
 * which is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
 */

package io.vertx.core.net;

import io.vertx.core.Vertx;

import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import java.util.function.Function;

/**
 * Certification authority configuration options.
 *
 * @author Julien Viet
 */
public interface TrustOptions {

  /**
   * @return a copy of these options
   */
  TrustOptions copy();

  /**
   * Create and return the trust manager factory for these options.
   * 

* The returned trust manager factory should be already initialized and ready to use. * * @param vertx the vertx instance * @return the trust manager factory */ TrustManagerFactory getTrustManagerFactory(Vertx vertx) throws Exception; /** * Returns a function that maps SNI server names to a {@link TrustManagerFactory} instance. * * The returned {@code TrustManagerFactory} must already be initialized and ready to use. * * The mapper is only used when the server has SNI enabled and the client indicated a server name. *

* The returned function may return {@code null} in which case {@link #getTrustManagerFactory(Vertx)} is used as fallback. * * @param vertx the vertx instance * @return the trustManager */ Function trustManagerMapper(Vertx vertx) throws Exception; /** * Returns a {@link TrustOptions} from the provided {@link TrustManager} * * @param trustManager the trustManager instance * @return the {@link TrustOptions} */ static TrustOptions wrap(TrustManager trustManager) { return new TrustManagerFactoryOptions(trustManager); } /** * Returns a {@link TrustOptions} from the provided {@link TrustManagerFactory} * * @param trustManagerFactory the trustManagerFactory instance * @return the {@link TrustOptions} */ static TrustOptions wrap(TrustManagerFactory trustManagerFactory) { return new TrustManagerFactoryOptions(trustManagerFactory); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy