BAEL-315 adding configuration for security on the config and discovery servers.
This commit is contained in:
parent
72b2eacb4f
commit
d3979102f8
|
@ -3,6 +3,6 @@ server.port=8082
|
|||
|
||||
eureka.instance.hostname=localhost
|
||||
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/
|
||||
eureka.client.serviceUrl.defaultZone=http://disc_discUser:discPassword@localhost:8082/eureka/
|
||||
eureka.client.register-with-eureka=false
|
||||
eureka.client.fetch-registry=false
|
||||
|
|
|
@ -3,7 +3,7 @@ server.port=8080
|
|||
|
||||
eureka.client.region = default
|
||||
eureka.client.registryFetchIntervalSeconds = 5
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/
|
||||
eureka.client.serviceUrl.defaultZone=http://disc_gatewayUser:gatewayPassword@localhost:8082/eureka/
|
||||
|
||||
zuul.routes.resource.path=/resource/**
|
||||
hystrix.command.resource.execution.isolation.thread.timeoutInMilliseconds: 5000
|
||||
|
|
|
@ -5,4 +5,4 @@ resource.returnString=hello cloud
|
|||
|
||||
eureka.client.region = default
|
||||
eureka.client.registryFetchIntervalSeconds = 5
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/
|
||||
eureka.client.serviceUrl.defaultZone=http://disc_resourceUser:resourcePassword@localhost:8082/eureka/
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.baeldung.spring.cloud.integration.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser("config_discUser")
|
||||
.password("discPassword")
|
||||
.and()
|
||||
.withUser("config_gatewayUser")
|
||||
.password("gatewayPassword")
|
||||
.and()
|
||||
.withUser("config_resourceUser")
|
||||
.password("resourcePassword");
|
||||
}
|
||||
}
|
|
@ -5,4 +5,4 @@ spring.cloud.config.server.git.uri=file:///${user.home}/application-config
|
|||
|
||||
eureka.client.region = default
|
||||
eureka.client.registryFetchIntervalSeconds = 5
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka
|
||||
eureka.client.serviceUrl.defaultZone=disc_configUser:configPassword@http://localhost:8082/eureka/
|
|
@ -28,6 +28,10 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.baeldung.spring.cloud.integration.discovery;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser("disc_configUser")
|
||||
.password("configPassword")
|
||||
.and()
|
||||
.withUser("disc_discUser")
|
||||
.password("discPassword")
|
||||
.and()
|
||||
.withUser("disc_gatewayUser")
|
||||
.password("gatewayPassword")
|
||||
.and()
|
||||
.withUser("disc_resourceUser")
|
||||
.password("resourcePassword");
|
||||
}
|
||||
}
|
|
@ -1,2 +1,4 @@
|
|||
spring.cloud.config.name=discovery
|
||||
spring.cloud.config.uri=http://localhost:8081
|
||||
spring.cloud.config.uri=http://localhost:8081
|
||||
spring.cloud.config.username=config_discUser
|
||||
spring.cloud.config.password=discPassword
|
|
@ -1,5 +1,7 @@
|
|||
spring.cloud.config.name=gateway
|
||||
spring.cloud.config.discovery.service-id=config
|
||||
spring.cloud.config.discovery.enabled=true
|
||||
spring.cloud.config.username=config_gatewayUser
|
||||
spring.cloud.config.password=gatewayPassword
|
||||
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/
|
|
@ -1,5 +1,7 @@
|
|||
spring.cloud.config.name=resource
|
||||
spring.cloud.config.discovery.service-id=config
|
||||
spring.cloud.config.discovery.enabled=true
|
||||
spring.cloud.config.username=config_resourceUser
|
||||
spring.cloud.config.password=resourcePassword
|
||||
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/
|
Loading…
Reference in New Issue