Is there a way I can authenticate the eureka client registration request? I have an external OAuth server from which I can get a JWT token which I would like to add to Authorization header when eureka client will try to register with the server. My eureka server will only allow the registration to go ahead if the JWT token is valid
Comment From: ryanjbaxter
Did you read http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#_authenticating_with_the_eureka_server? Sounds like you might need to look into creating your own DiscoveryClientOptionalArgs bean.
Comment From: avi-kalar
Can you please share more details onto how we can make use of DiscoveryClientOptionalArgs?
Comment From: ryanjbaxter
Spring Cloud Services uses this approach because the Eureka implementation there is protected by OAuth2. You can take a look at how they use DiscoverClientOptionalArgs here https://github.com/pivotal-cf/spring-cloud-services-connector/blob/master/spring-cloud-services-spring-connector/src/main/java/io/pivotal/spring/cloud/service/eureka/EurekaOAuth2AutoConfiguration.java
Comment From: avi-kalar
Thank you Ryan, Let me take a check this out
Comment From: kavinash-athena
It worked. Thank you Ryan. We can close this.
Comment From: Soggywaters
Link is broken as of 4-27-21. I think this is the file?
https://github.com/pivotal-cf/spring-cloud-services-connector/blob/main/spring-cloud-services-spring-connector/src/main/java/io/pivotal/spring/cloud/service/eureka/EurekaClientOAuth2AutoConfiguration.java