spring cloud config discovery enabled with basic authentication - spring-boot

I am using a Spring Cloud Config server with the following eureka and basic security configuration.
The client gets the config server uri correctly through eureka, however cannot access to the properties data because basic authentication is not working on the client side.
I would appreciate some help to understand how to fix this situation.
The Spring Cloud Config server is the following:
eureka.client.serviceUrl.defaultZone=http://localhost:8010/eureka
eureka.instance.hostname=localhost
eureka.instance.non-secure-port-enabled=false
eureka.instance.secure-port-enabled=true
eureka.instance.statusPageUrl=https://${eureka.hostname}:${server.port}/actuator/info
eureka.instance.healthCheckUrl=https://${eureka.hostname}:${server.port}/health
eureka.instance.homePageUrl=https://${eureka.hostname}:${server.port}/
spring.security.user.name=admin
spring.security.user.password=pass
The client configuration is the following:
eureka.client.serviceUrl.defaultZone=http://localhost:8010/eureka
eureka.instance.hostname=localhost
eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}}
eureka.instance.non-secure-port-enabled=false
eureka.instance.secure-port-enabled=true
eureka.instance.statusPageUrl: https://${eureka.hostname}:${server.port}/actuator/info
eureka.instance.healthCheckUrl: https://${eureka.hostname}:${server.port}/health
eureka.instance.homePageUrl: https://${eureka.hostname}:${server.port}/
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=trm-config-server
spring.cloud.config.username=admin
spring.cloud.config.password=pass
spring.cloud.config.name=users-ws

Related

Spring Cloud Gateway Proxy Host issue

I am running Spring Cloud Gateway with Spring Boot version 2.5.8 and Spring Cloud version 2020.0.5.
I am trying to configure Spring Cloud Gateway to validate JWT access tokens using Spring Security and thus the gateway needs to connect to the OAuth2 Authorization server external to my company's network. As per company standard, I am using a proxy host to connect to the external Authorization server and I have set the http.proxy* and https.proxy* environment variables ie
-Dhttp.proxyHost=my-proxy.com -Dhttp.proxyPort=3328 -Dhttps.proxyHost=my-proxy..com -Dhttps.proxyPort=3328 -Dhttp.proxySet=true -Dhttps.proxySet=true
and well as the properties in application.yml. ie
spring:
cloud:
httpclient:
proxy:
host: my-proxy.com
port: 3328
But I am getting timeout error when connecting to the external Authorization Server. The proxy host and port are correct and are working for other Spring Boot projects using Spring MVC. I saw this question/answer
spring-boot app as spring-cloud-gateway has to use a proxy: JVM arguments not used NOR spring.cloud.gateway.httpclient.proxy.****
But my entries in application.yml is not working. Would appreciate if someone can provide some advice on resolving the issue.
Thanks

Load properties from application.properties in Spring Cloud Config until refreshed

I've a setup with Spring Cloud Config Server and Client as described in the response here. The next thing I'm trying to do is load the properties from application.properties in the client when the service starts. Once I call /actuator/refresh I would like to load it from the Config Server. Is this even possible? Thanks!

Spring boot admin not showing secured endpoints of spring boot client

Installed spring boot admin and server.
All client endpoints are visible in spring boot admin but after adding security dependency in client secured endpoints are not visible in admin.
Provided credentials of admin and client in application.yaml of client.
Had the same problem. Firstly, you need to share user and password from admin-client, this can be configured in yml file:
spring.boot.admin.client:
url: http://localhost:8080
instance:
metadata:
user.name: ${spring.security.user.name}
user.password: ${spring.security.user.password}
Also you need to enable http basic in security config, because SBA server then uses this metadata to make http calls.
source: https://codecentric.github.io/spring-boot-admin/2.2.3/#_securing_client_actuator_endpoints

What is bootstrap yaml in spring boot

What is bootstrap yaml in spring boot?
And could you advise where I can use it?
bootstrap.yml is used in spring cloud
It is starting before application.yml
It is almost use with spring cloud config server
Spring cloud config server is server which is used to externilize your application configuration.
And when starting your application bootstrap.yml will take the configuration from spring cloud config server.
It also can use encrypting and decrypting some information by :
'{cipher}someyour encoded text'
and server will decode it while pulling the configurations
But you need to create jks
You can reach the documentation for more information about spring cloud :
https://spring.io/guides/gs/centralized-configuration/
Configuration files in spring boot will be loaded in such order:
1. src/main/resources/bootstrap.yml
2. src/main/resources/application.yml
3. config/application.yml

Spring Cloud Config Server - Security Details

I implemented spring cloud config server and pushed it to pivotal cloud foundry. I added the below listed security details in application.yml. I did a "get" on the config server endpoint without passing any security credentials. I am able to receive a successful response , but I was expecting it to return an error saying authentication details aren't passed. Please can you let me know what I am missing?
security:
basic:
enabled: true
user:
name: ctp_config
password: ctp_config
If you using Spring Boot, try add to dependency 'org.springframework.boot:spring-boot-starter-security'

Resources