Username and password are required when configuring eureka service access in springcloud

Username and password are required when configuring eureka service access in springcloud

1. Configure the login link with username and password in application.yml:

eureka:
  client:
    service-url:
      defaultZone: http://user:password123@localhost:8761/eureka

 2. Add security configuration to application.yml:

security:
  basic:
    enabled: true
  user:
    name: user
    password: password123

 3. Introduce spring-cloud-starter-security dependency in pom.xml:

<dependency>
	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-starter-security</artifactId>
</dependency>

 4. Open http://127.0.0.1:8761, you will be prompted for a username and password when accessing, fill in the correct username: user, and the correct password: password123, you can enter the web page provided by eureka

 5. Register the service in this eureka with username and password authentication

eureka:
  client:
    serviceUrl:
      defaultZone: http://user:password123@localhost:8761/eureka
                  #Configure the username and password in the defaultZone address http://localhost:8761/eureka

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326137994&siteId=291194637