如何配置 Feign 以仅使用 TLS1.3 和某些密码?

问题描述 投票:0回答:0

如何配置 Feign 以仅使用 TLS1.3 和某些密码?

对于其他服务,我有一个带有 Apache

RestTemplate
HttpClient

bean
    @Bean
    public RestTemplate getRestTemplate(final ResponseErrorHandler responseErrorHandler) {
        final var authHeaderRestTemplate = new RestTemplate(
            new HttpComponentsClientHttpRequestFactory(getHttpClient())
        );
        authHeaderRestTemplate.setErrorHandler(responseErrorHandler);
        return authHeaderRestTemplate;
    }

    @SneakyThrows
    private static HttpClient getHttpClient() {
        final var sslContext = SSLContext.getDefault();
        final var sslConnectionSocketFactory = new SSLConnectionSocketFactory(
            sslContext,
            SUPPORTED_PROTOCOLS,
            SUPPORTED_CIPHERS,
            javax.net.ssl.HttpsURLConnection.getDefaultHostnameVerifier()
        );
        return HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build();
    }

但据我所知,Feign 不使用 HttpClient 或 RestTemplate。

我想提供一个 bean,它将 Feign 配置为使用正确的 TLS 版本和密码,并且可能还为请求设置授权标头。

我该怎么做?

spring-cloud-feign feign
© www.soinside.com 2019 - 2024. All rights reserved.