Package es.kukenan.smartfi.config
Class ClientConfigServiceBootstrapConfiguration
java.lang.Object
es.kukenan.smartfi.config.ClientConfigServiceBootstrapConfiguration
This class was created because of the need to customize the security of the configuration server API. Its main function is to apply the next
functions to the HTTP communications with the configuration server:
- Bearer authentication with a JWT token.
- Trust SSL certificates in non-production environments.
See also "META-INF/spring.factories".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe JWT token.private booleanTrust invalid self-signed server certificate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.http.client.ClientHttpRequestFactoryCreate aClientHttpRequestFactorythat may trust (seetrustSslCert) invalid self-signed certificated.org.springframework.cloud.config.client.ConfigServicePropertySourceLocatorconfigServicePropertySourceLocator(org.springframework.cloud.config.client.ConfigClientProperties configClientProperties) Overrides the defaultConfigServicePropertySourceLocatorwith a new one that supports the customized security options.private org.springframework.web.client.RestTemplateCreate aRestTemplatethat supports the customized security options.
-
Field Details
-
clientJwt
The JWT token. -
trustSslCert
@Value("${client.trustSslCert}") private boolean trustSslCertTrust invalid self-signed server certificate.
-
-
Constructor Details
-
ClientConfigServiceBootstrapConfiguration
public ClientConfigServiceBootstrapConfiguration()
-
-
Method Details
-
configServicePropertySourceLocator
@Bean public org.springframework.cloud.config.client.ConfigServicePropertySourceLocator configServicePropertySourceLocator(@Autowired org.springframework.cloud.config.client.ConfigClientProperties configClientProperties) Overrides the defaultConfigServicePropertySourceLocatorwith a new one that supports the customized security options.- Parameters:
configClientProperties- configuration client properties (see "bootstrap.properties").- Returns:
- a
ConfigServicePropertySourceLocatorthat supports the customized security options.
-
customRestTemplate
private org.springframework.web.client.RestTemplate customRestTemplate()Create aRestTemplatethat supports the customized security options.- Returns:
- a
RestTemplatethat supports the customized security options.
-
clientHttpRequestFactory
private org.springframework.http.client.ClientHttpRequestFactory clientHttpRequestFactory()Create aClientHttpRequestFactorythat may trust (seetrustSslCert) invalid self-signed certificated.- Returns:
- a
ClientHttpRequestFactorythat may trust (seetrustSslCert) invalid self-signed certificated.
-