0

I'm working with a simple example of a Spring Boot Eureka service registration. I am using spring-boot-starter 1.5.4.RELEASE, spring-cloud-starter-eureka 1.3.1.RELEASE. The eureka server should register the client instance only if the registration request are coming from white-listed servers.

Is there any out of box feature available in Spring Boot Eureka to achieve this requirement.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Raja
  • 11

1 Answers1

1

The username and password for login is more preferred.

  1. Add maven dependency:

    <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> </dependencies>

  2. Add username and password and other configurations to your configuration file application.yaml, note that the client.service-url.defaultZone should contain username and password:

security: basic: enabled: true user: name: user password: 123456 server: port: 8761 eureka: instance: hostname: localhost client: register-with-eureka: false fetch-registry: false service-url: defaultZone: http://user:123456@${eureka.instance.hostname}:${server.port}/eureka/

Hash Jang
  • 599
  • 3
  • 11