如何使用 docker 实施 spring 云配置服务器安全性
how to implement spring cloud config server security with docker
我想使用 spring 云配置服务器安全性:
我在以下位置找到示例:https://github.com/spring-cloud-samples/config-repo/blob/master/application.yml
profile:
cloud:
config:
uri: ${vcap.services.${PREFIX:}configserver.credentials.uri:http://user:password@${PREFIX:}configserver.${application.domain:cfapps.io}}
但是:我不明白:有些词是什么意思?
例如
- vcap.services
- ${前缀:}configserver.credentials.uri
- ${前缀:}
- ${PREFIX:}配置服务器
- ${前缀:}sso.credentials.tokenUr
而且,如果我使用 docker 而不是云配置文件,就像这样:
docker
config:
uri: http://${CONFIGSERVER_1_PORT_8888_TCP_ADDR:localhost}:8888
client:
serviceUrl:
defaultZone: http://${EUREKA_1_PORT_8761_TCP_ADDR:localhost}:8761/eureka/
when i try this :
在 coifing-server application.yml :
security:
user:
password: 1
在客户端-服务器中 application.yml
spring:
cloud:
config:
uri: http://user:1@localhost:8888
客户端-服务器控制台有错误:
c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: label not found
Whole Code is in : https://github.com/keryhu/coud-config-security
我如何实施安全配置?
可以帮我吗?
您是否配置了自定义 spring 安全配置?
url 需要在 bootstrap 阶段
中设置访问配置服务器的凭据
您还可以使用 WebSecurityConfigurer 更改安全性
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
您需要在 bootstrap.yml(或 .properties)中设置配置服务器 URI,因为在 bootstrap 阶段需要它。
我想使用 spring 云配置服务器安全性:
我在以下位置找到示例:https://github.com/spring-cloud-samples/config-repo/blob/master/application.yml
profile:
cloud:
config:
uri: ${vcap.services.${PREFIX:}configserver.credentials.uri:http://user:password@${PREFIX:}configserver.${application.domain:cfapps.io}}
但是:我不明白:有些词是什么意思?
例如
- vcap.services
- ${前缀:}configserver.credentials.uri
- ${前缀:}
- ${PREFIX:}配置服务器
- ${前缀:}sso.credentials.tokenUr
而且,如果我使用 docker 而不是云配置文件,就像这样:
docker
config:
uri: http://${CONFIGSERVER_1_PORT_8888_TCP_ADDR:localhost}:8888
client:
serviceUrl:
defaultZone: http://${EUREKA_1_PORT_8761_TCP_ADDR:localhost}:8761/eureka/
when i try this :
在 coifing-server application.yml :
security:
user:
password: 1
在客户端-服务器中 application.yml
spring:
cloud:
config:
uri: http://user:1@localhost:8888
客户端-服务器控制台有错误:
c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: label not found
Whole Code is in : https://github.com/keryhu/coud-config-security
我如何实施安全配置?
可以帮我吗?
您是否配置了自定义 spring 安全配置? url 需要在 bootstrap 阶段
中设置访问配置服务器的凭据您还可以使用 WebSecurityConfigurer 更改安全性
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
您需要在 bootstrap.yml(或 .properties)中设置配置服务器 URI,因为在 bootstrap 阶段需要它。