当前位置: 首页 > 知识库问答 >
问题:

无法注册客户端-Spring Boot Admin 2.0.2

朱令
2023-03-14

我正在根据文件进行开发:https://codecentric.github.io/spring-boot-admin/2.0.2,但我没有在安全应用程序中注册客户端。

我的配置是:

应用yml

# Security config
spring.security.user:
  name: admin
  password: admin

# Actuator config
management:
  endpoint:
    shutdown.enabled: true
    health.show-details: always
  endpoints.web.exposure.include: '*'

# Spring boot admin config
spring.boot.admin:
  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}

网络安全配置

@Configuration
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
    private final String adminContextPath;

    public WebSecurityConfiguration(AdminServerProperties adminServerProperties) {
        this.adminContextPath = adminServerProperties.getContextPath();
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
        successHandler.setTargetUrlParameter("redirectTo");
        successHandler.setDefaultTargetUrl(adminContextPath + "/");

        http.authorizeRequests()
                .antMatchers(adminContextPath + "/assets/**").permitAll()
                .antMatchers(adminContextPath + "/login").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
                .logout().logoutUrl(adminContextPath + "/logout").and()
                .httpBasic().and()
                .csrf()
                .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
                .ignoringAntMatchers("/instances", "/actuator/**");
    }

}

错误正在发生:

2018-08-22 00:44:21.770调试9616---[RegistrationTaskK1]d.c.b.a.c.r.ApplicationRegistrator:未能将应用程序注册为应用程序(名称=模板api,管理URL)=http://localhost:8080/actuator,健康网址=http://localhost:8080/actuator/health,serviceUrl=http://localhost:8080/)在spring boot admin([http://localhost:8080/admin/instances]):401空

有人能帮我做这件事吗?

更新日期2018-09-01:

我尝试了不同的配置,但出现了相同的错误:

# Security config
spring.security.user:
  name: test-name
  password: test-password

# Spring boot admin config  
spring.boot.admin:
  context-path: /admin

客户端:

# Spring boot admin config
spring.boot.admin:
  client:
    url: http://localhost:8080/admin
    username: test-name
    password: test-password
    instance:
      name: ${app.name}
      metadata.user:
        name: test-name
        password: test-password

共有2个答案

乐正育
2023-03-14

Spring Boot管理文档中有一个bug。已经修好了。

https://github.com/codecentric/spring-boot-admin/issues/894

杨晓博
2023-03-14

401未经授权的错误是一个HTTP状态代码,这意味着在您首次使用有效的用户ID和密码登录之前,无法加载您试图访问的页面。您是否正确配置了客户端和管理服务器??

您可以在这里查看我的服务器和客户端spring boot应用程序的示例源代码,包括有无安全配置
https://github.com/anandvarkeyphilips/spring-boot-admin/tree/master/spring-boot-admin-samples

 类似资料:
  • Spring启动管理版本:2.0.4 我试图支持LDAP安全性来登录到Spring Boot Admin,但也支持注册到SPA服务器的客户端的基本身份验证。在LDAP完全关闭的情况下,我无法让客户端向服务器注册。 我犯的错误 将应用程序注册为Application失败(name=spall-boot-Application, Management ementUrl=... 服务器applicati

  • 在开始协议前,客户端在授权服务器注册。客户端在授权服务器上注册所通过的方式超出了本规范,但典型的涉及到最终用户与HTML注册表单的交互。 客户端注册不要求客户端与授权服务器之间的直接交互。在授权服务器支持时,注册可以依靠其他方式来建立信任关系并获取客户端的属性(如重定向URI、客户端类型)。例如,注册可以使用自发行或第三方发行声明或通过授权服务器使用信任通道执行客户端发现完成。 当注册客户端时,客

  • 我有一个工作中的Eureka注册表,其中注册了许多Spring-Boot应用程序。我知道这是有效的,因为他们能够找到对方,并通过尤里卡注册中心进行交流。 当我启动我的新SBA应用程序时,我可以看到它自己在Eureka注册表中注册,所以它正在查找Eureka。然而,当我打开SBA UI时,它是空的,只是说“没有应用程序注册。”在我的控制台上,我可以一遍又一遍地看到下面的堆栈跟踪。

  • 本规范不排除使用未注册的客户端。然而,使用这样的客户端超出了本规范的范围,并需要额外的安全性分析并审查其互操作性影响。

  • 如果我从命令行创建RMI注册表,则客户端将对象绑定到注册表没有问题。 但是,如果我使用启动RMI注册表,它会出错。 这是我使用创建的代码 当我尝试绑定到我自己的RMI注册表时,我因使用而遇到的错误 是一个接口 有什么想法吗?