Настройка Springboot Cloud Config Server - management.security.enabled = false flag Не работает

Я пытаюсь реализовать сервер конфигурации облачной загрузки Spring.

Мой файл application.properties:

#Server port
server.port=8888

#Git repo location.
spring.cloud.config.server.git.uri=/home/pawan/git/config-server-repo

#Disable security of the Management endpoint
management.security.enabled=false

Основной класс:

@EnableConfigServer
@SpringBootApplication
public class ConfigServer {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServer.class, args);
    }
}

Проблема в том, что когда я пытаюсь использовать свойство конфигурации клиента из URL-адреса браузера, например http://localhost:8888/client-config/test, меня перенаправляют на страницу входа.

config-server-browser-screenshot

Журнал запуска сервера конфигурации:

    > Task :bootRun
2019-07-10 16:14:29.117  INFO 8935 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a652cf6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.6.RELEASE)

2019-07-10 16:14:30.390  INFO 8935 --- [           main] com.bizlers.cloud.config.ConfigServer    : No active profile set, falling back to default profiles: default
2019-07-10 16:14:32.036  INFO 8935 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=6f9cbfc9-e5b5-3f1c-b6b3-2dde90ebde06
2019-07-10 16:14:32.107  INFO 8935 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a652cf6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-10 16:14:32.558  INFO 8935 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8888 (http)
2019-07-10 16:14:32.602  INFO 8935 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-10 16:14:32.603  INFO 8935 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-07-10 16:14:32.744  INFO 8935 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-10 16:14:32.744  INFO 8935 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2335 ms
2019-07-10 16:14:34.095  INFO 8935 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-10 16:14:34.638  INFO 8935 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: 844bac77-1ec4-4f76-bebc-0460c3b36e6f

2019-07-10 16:14:34.773  INFO 8935 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@1ab53860, org.springframework.security.web.context.SecurityContextPersistenceFilter@3ffd4b12, org.springframework.security.web.header.HeaderWriterFilter@274fdea6, org.springframework.security.web.csrf.CsrfFilter@5d7f8467, org.springframework.security.web.authentication.logout.LogoutFilter@2dd0a0d0, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@24a04257, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@633ddc0c, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@7b5ac347, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@6d6039df, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2ad7bd26, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@76a6f045, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@57b9389f, org.springframework.security.web.session.SessionManagementFilter@2a484710, org.springframework.security.web.access.ExceptionTranslationFilter@3f6c2763, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@150d6eaf]
2019-07-10 16:14:34.808  INFO 8935 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-07-10 16:14:35.881  INFO 8935 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-07-10 16:14:36.223  INFO 8935 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8888 (http) with context path ''
2019-07-10 16:14:36.225  INFO 8935 --- [           main] com.bizlers.cloud.config.ConfigServer    : Started ConfigServer in 9.234 seconds (JVM running for 9.956)
2019-07-10 16:14:45.838  INFO 8935 --- [nio-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-07-10 16:14:45.838  INFO 8935 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-07-10 16:14:45.849  INFO 8935 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 11 ms

Я также пробовал добавить security.basic.enabled=false в application.properties, но это не помогает.

Зависимости:

  • springBootVersion = '2.1.6.RELEASE'
  • springCloudVersion = "Greenwich.SR1"

person Pawan    schedule 10.07.2019    source источник


Ответы (1)


management.security.enabled использовался с приводом пружинной загрузки версии 1. Начиная с Spring boot 2, вы должны / можете настроить безопасность своей конечной точки, используя:

<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-security</artifactId>
</dependency>

См. Эту ссылку для получения дополнительной информации: https://spring.io/guides/gs/securing-web/.

Я предлагаю вам проверить конфигурацию безопасности, одно из правил требует аутентифицированного пользователя.

person RUARO Thibault    schedule 24.12.2019
comment
Я давно задумывался над этим вопросом. Я попробую это решение, как только у меня будет немного времени, и вернусь. - person Pawan; 10.06.2020