【问题标题】:Adding security to rest api service built with Spring Boot app为使用 Spring Boot 应用程序构建的 REST API 服务添加安全性
【发布时间】:2015-06-09 14:44:36
【问题描述】:

我已经设法使用 Spring boot 执行器构建了一个 rest api,它运行良好。我现在需要为应用程序添加安全性,并找到一个链接,表明需要做的就是将以下内容添加到 pom 文件中:

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

我试过了,但没有得到预期的结果,即在控制台中看到以下内容;

Using default security password: 7dfsdg4d0-4dfsdfsd93-dsdf9f8-axxe1-xxxxxx

任何建议或解决方案的链接,将不胜感激。

【问题讨论】:

    标签: rest spring-boot


    【解决方案1】:

    我以前做过这个,它可以工作,尽管我认为某些版本的 Spring Boot 在这个特性上存在问题。我正在使用它,如果您复制了任何示例,则可能有一些其他配置覆盖了它。我认为this link 有很好的信息。确保您的属性文件中没有任何内容,例如“security.user.password”,并且您没有像 @EnableWebSecurity 这样覆盖任何默认值的注释。让我知道这是否有帮助,如果没有帮助,也许您可​​以将链接发送到 GitHub,您的代码供他人查看。

    【讨论】:

      猜你喜欢
      • 2018-03-25
      • 2017-03-13
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 2020-04-05
      • 2021-11-19
      • 2015-01-31
      • 1970-01-01
      相关资源
      最近更新 更多