Class ClientConfigServiceBootstrapConfiguration

java.lang.Object
es.kukenan.smartfi.config.ClientConfigServiceBootstrapConfiguration

@Configuration public class ClientConfigServiceBootstrapConfiguration extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private String
    The JWT token.
    private boolean
    Trust invalid self-signed server certificate.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private org.springframework.http.client.ClientHttpRequestFactory
    Create a ClientHttpRequestFactory that may trust (see trustSslCert) invalid self-signed certificated.
    org.springframework.cloud.config.client.ConfigServicePropertySourceLocator
    configServicePropertySourceLocator(org.springframework.cloud.config.client.ConfigClientProperties configClientProperties)
    Overrides the default ConfigServicePropertySourceLocator with a new one that supports the customized security options.
    private org.springframework.web.client.RestTemplate
    Create a RestTemplate that supports the customized security options.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • clientJwt

      @Value("${client.jwt}") private String clientJwt
      The JWT token.
    • trustSslCert

      @Value("${client.trustSslCert}") private boolean trustSslCert
      Trust 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 default ConfigServicePropertySourceLocator with a new one that supports the customized security options.
      Parameters:
      configClientProperties - configuration client properties (see "bootstrap.properties").
      Returns:
      a ConfigServicePropertySourceLocator that supports the customized security options.
    • customRestTemplate

      private org.springframework.web.client.RestTemplate customRestTemplate()
      Create a RestTemplate that supports the customized security options.
      Returns:
      a RestTemplate that supports the customized security options.
    • clientHttpRequestFactory

      private org.springframework.http.client.ClientHttpRequestFactory clientHttpRequestFactory()
      Create a ClientHttpRequestFactory that may trust (see trustSslCert) invalid self-signed certificated.
      Returns:
      a ClientHttpRequestFactory that may trust (see trustSslCert) invalid self-signed certificated.