Kery Hu
Kery Hu

Reputation: 5906

how to implement spring cloud config server security with docker

I want to use spring cloud config server security :

I find the example in : 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 ?

e.g.

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

And , if i use docker instead of cloud profile , like this :

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 :

security:
  user:
    password: 1

in client-server 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

How do i implement security config ?

can help me?

Upvotes: 0

Views: 1309

Answers (2)

Dave Syer
Dave Syer

Reputation: 58094

You need to set the config server URI in bootstrap.yml (or .properties) because it is needed in the bootstrap phase.

Upvotes: 2

Kamil Kiewisz
Kamil Kiewisz

Reputation: 1

Did you configure custom spring security configuration? url and credentials to access config server needs to be setup in bootstrap phase

additional you can change security using WebSecurityConfigurer @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

Upvotes: 0

Related Questions