[英]how to implement spring cloud config server security with docker
我想使用Spring Cloud Config Server安全性:
我在以下位置找到示例: 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}}
但是:我不明白:这几个词是什么意思?
例如
而且,如果我使用docker而不是cloud profile,像这样:
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/
当我尝试这个:
在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
如何实现安全配置?
可以帮我?
您需要在bootstrap.yml(或.properties)中设置配置服务器URI,因为在引导阶段需要它。
您是否配置了自定义spring安全配置? 需要在引导阶段设置访问配置服务器的URL和凭据
另外,您可以使用WebSecurityConfigurer @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
来更改安全性@Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.