【问题标题】:Spring Eureka asks for username password authenticationSpring Eureka 要求用户名密码认证
【发布时间】:2020-03-03 17:19:52
【问题描述】:
    Using generated security password: f9268f9c-f2e6-4e53-a751-632a7005b807

2020-03-03 13:07:44.539  INFO 4824 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2a92f8c3, org.springframework.security.web.context.SecurityContextPersistenceFilter@412324cd, org.springframework.security.web.header.HeaderWriterFilter@7cf2dd91, org.springframework.security.web.csrf.CsrfFilter@565adf96, org.springframework.security.web.authentication.logout.LogoutFilter@5b3457db, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@b1041fc, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@5e842f37, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@3e06198f, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@574d3e0c, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2b5beb1d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@4d02763e, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@b273c65, org.springframework.security.web.session.SessionManagementFilter@1f6d3131, org.springframework.security.web.access.ExceptionTranslationFilter@1bf860da, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@11538685]
2020-03-03 13:07:44.612  WARN 4824 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : Unable to start LiveReload server

我没有在 POM 文件中包含 spring 安全依赖项,但我在控制台中看到了这些行。浏览器提示输入用户名和密码。我该如何解决这个问题?

【问题讨论】:

  • 运行 mvn dependency:tree 和 grep spring security 来检查它是否以某种方式出现
  • 哦,我的错。默认情况下,它具有问题中所示的用户名 user 和密码。有什么方法可以覆盖它?
  • 你需要安全吗?
  • 有没有办法自定义用户名和密码?是的,我需要安全

标签: spring authentication spring-security microservices netflix-eureka


【解决方案1】:

我不认为你应该在 POM 中验证或依赖

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>

【讨论】:

  • 是否包含在 Eureka 包中?
  • 有什么方法可以更改 Eureka 中的默认凭据?
  • 在 pom 中将依赖设置为注释或删除
【解决方案2】:

解决了! Eureka 服务器默认有用户名密码认证。默认用户名是user,密码会在控制台生成!

【讨论】:

    猜你喜欢
    • 2012-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    • 2016-05-10
    • 2011-11-19
    • 2011-08-23
    • 1970-01-01
    相关资源
    最近更新 更多