Spring boot admin не может зарегистрироваться сам? - PullRequest
0 голосов
/ 22 января 2020

Недавно я включил весеннюю защиту в моем приложении админ-сервера весенней загрузки, а теперь, когда я получаю доступ к меню приложений из админки весенней загрузки, сам админ весенней загрузки отображается как выключенный. Когда я вхожу, чтобы увидеть информацию об этом, я вижу, что ему не удалось установить это как исправное, потому что конечная точка / actator / health вернула следующее json:

{
    "statusInfo": {
        "status": "DOWN",
        "details": {
            "path": "/actuator/health",
            "error": "Unauthorized",
            "message": "Unauthorized",
            "status": 401,
            "timestamp": "2020-01-22T13:29:45.867+0000"
        }
    }
}

# Spring configs

spring:
  application:
    name: "${app.name}"
  security:
    user:
      name: admin
      password: admin


# Spring boot admin config
spring.boot.admin:
  ui:
    title: "VOSBMS Administrator"
    brand: <img src="logo.png"><span>VOSBMS Administrator</span
  context-path: /admin
  client:
    url: http://localhost:8080/admin
    username: ${spring.security.user.name}
    password: ${spring.security.user.password}
    instance:
      name: ${app.name}
      metadata.user:
        name: ${spring.security.user.name}
        password: ${spring.security.user.password}

# Management configs

management:
  security:
    enabled: true
  endpoint:
    health:
      show-details: "ALWAYS"
  endpoints:
    web:
      exposure:
        include: "*"

# Eureka configurations

eureka:
  client:
    serviceUrl:
      defaultZone: "http://localhost:9200/eureka/"
  instance:
    lease-renewal-interval-in-seconds: 5

И Вот моя конфигурация безопасности:

SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(this.adminContextPath + "/");

http.authorizeRequests((authorizeRequests) -> authorizeRequests
        .antMatchers(this.adminContextPath + "/assets/**").permitAll()
        .antMatchers(this.adminContextPath + "/login").permitAll().anyRequest().authenticated())
        .formLogin((formLogin) -> formLogin.loginPage(this.adminContextPath + "/login")
                .successHandler(successHandler))
        .logout((logout) -> logout.logoutUrl(this.adminContextPath + "/logout"))
        .httpBasic(Customizer.withDefaults())
        .csrf((csrf) -> csrf.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
                .ignoringRequestMatchers(
                        new AntPathRequestMatcher(this.adminContextPath + "/instances",
                                HttpMethod.POST.toString()),
                        new AntPathRequestMatcher(this.adminContextPath + "/instances/*",
                                HttpMethod.DELETE.toString()),
                        new AntPathRequestMatcher(this.adminContextPath + "/actuator/**")));

Есть идеи, почему я получаю 401 статус на / привод / конечная точка работоспособности?

...