springboot环境下,用postman调试接口,一直正常,今天突然出现以下错误:

{
  "timestamp": "2018-03-05 14:43:45",
  "status": 401,
  "error": "Unauthorized",
  "message": "Full authentication is required to access this resource",
  "path": "/apptplatform/login"

}

上网搜一下解决方法,有人提出在配置中添加以下配置:

#忽略权限拦截
management:
  security:
    enabled: false

并导入以下maven依赖(项目此前并没有此依赖)

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

很可惜,问题依然存在。

由于项目的参与人员不多,问了下大家,有人添加了springboot的cloud依赖:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
最后解决方法,如下图配置

security:
  basic:
    enabled: false

可以关闭springboot的安全验证。

此功能只是在配置上关闭安全验证,项目以后还是要打开此验证的。


查了下maven,oauth2这个包,本身依赖了security的包

屏蔽Full authentication is required to access this resource














相关文章:

  • 2021-04-10
  • 2021-12-13
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-02-08
  • 2021-11-01
  • 2021-06-11
  • 2022-12-23
相关资源
相似解决方案