add filters in configServer

…衆ロ難τιáo~ 提交于 2021-01-29 11:22:13

问题


With this architecture, i created a configServer that point to git repository where all my configurations are stored

Now, i want to secure this configurations because it contains a critic information (as servers, passwords, ...etc.)

So, to do that i fount this

By adding the dependency spring-boot-starter-security to the configServer, then defining user, password in the application.properties my configuration's files are now protected by Basic Authentication

Now, i must share my user/password to every client bootstrap.yml so they can fetch configurations from configServer

spring.cloud.config.uri: http://localhost:8888
spring.application.name: ws-config
spring.profiles.active: default
spring.cloud.config.label: local_dev
spring.cloud.config.username: user
spring.cloud.config.password: password

This work perfectly for me, now every micro-service can fetch it's own configuration by the authentication user, password

Now, i want to do this in an other way (if possible)

Defining a security in configServer (only in configServer) by filters or cross-origins, so the goal is to not sharing any user, password with clients

So, something like this

config.setAllowedOrigins(Arrays.asList("http://localhost:8085", "http://localhost:8081", "http://localhost:8080")); //mean only this links can fetch configurations from configServer

来源:https://stackoverflow.com/questions/55729819/add-filters-in-configserver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!