简体   繁体   English

如何使用Docker来实现Spring Cloud Config Server安全性

[英]how to implement spring cloud config server security with docker

I want to use spring cloud config server security : 我想使用Spring Cloud Config Server安全性:

I find the example in : https://github.com/spring-cloud-samples/config-repo/blob/master/application.yml 我在以下位置找到示例: 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}}

But: i can not understand : whats the some words meaning ? 但是:我不明白:这几个词是什么意思?

eg 例如

  1. vcap.services vcap.services
  2. ${PREFIX:}configserver.credentials.uri $ {PREFIX:} configserver.credentials.uri
  3. ${PREFIX:} $ {PREFIX:}
  4. ${PREFIX:}configserver $ {PREFIX:} configserver
  5. ${PREFIX:}sso.credentials.tokenUr $ {PREFIX:} sso.credentials.tokenUr

And , if i use docker instead of cloud profile , like this : 而且,如果我使用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/

when i try this : 当我尝试这个:

in coifing-server application.yml : 在coifing-server application.yml中:

security:
  user:
    password: 1

in client-server application.yml 在客户端服务器application.yml中

spring:
  cloud:
    config:
      uri: http://user:1@localhost:8888

The client-server console has errors : 客户端服务器控制台有错误:

 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 整个代码在: https : //github.com/keryhu/coud-config-security

How do i implement security config ? 如何实现安全配置?

can help me? 可以帮我?

您需要在bootstrap.yml(或.properties)中设置配置服务器URI,因为在引导阶段需要它。

Did you configure custom spring security configuration? 您是否配置了自定义spring安全配置? url and credentials to access config server needs to be setup in bootstrap phase 需要在引导阶段设置访问配置服务器的URL和凭据

additional you can change security using WebSecurityConfigurer @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 另外,您可以使用WebSecurityConfigurer @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {来更改安全性@Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM