aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/jdisc/http/SslProvider.java
blob: bbdba3959100a2c2aff60f32b25fcb43edcd2b07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http;

import javax.net.ssl.SSLContext;
import java.security.KeyStore;
import java.util.List;

/**
 * Provides SSL/TLS configuration for a server connector.
 *
 * @author bjorncs
 */
public interface SslProvider extends AutoCloseable {

    interface ConnectorSsl {
        enum ClientAuth { DISABLED, WANT, NEED }
        ConnectorSsl setSslContext(SSLContext ctx);
        ConnectorSsl setClientAuth(ConnectorSsl.ClientAuth auth);
        ConnectorSsl setEnabledCipherSuites(List<String> ciphers);
        ConnectorSsl setEnabledProtocolVersions(List<String> versions);
        ConnectorSsl setKeystore(KeyStore keystore, char[] password);
        ConnectorSsl setKeystore(KeyStore keystore);
        ConnectorSsl setTruststore(KeyStore truststore, char[] password);
        ConnectorSsl setTruststore(KeyStore truststore);
    }

    /**
     * Invoked during configuration of server connector
     * @param ssl provides methods to modify default SSL configuration
     * @param name The connector name
     * @param port The connector listen port
     */
    void configureSsl(ConnectorSsl ssl, String name, int port);

    @Override default void close() {}
}