【问题标题】:Feign Exception 403 after updating to Spring Boot 1.5.8 and Finchley/Edgware Spring Cloud更新到 Spring Boot 1.5.8 和 Finchley/Edgware Spring Cloud 后 Feign Exception 403
【发布时间】:2018-04-30 08:11:16
【问题描述】:

我对微服务比较陌生,我一直在尝试使用这个proof-of-concept application,它使用了Spring BootSpring Cloud

问题在于,虽然应用在 Spring Boot 1.3.5Spring Cloud Brixton.RELEASE 上运行良好,但在升级其中任何一个时都会中断。

注册新账号时出现错误,报如下错误:

status 403 reading AuthServiceClient#createUser(User); content:↵{"timestamp":1510753211255,"status":403,"error":"Forbidden","message":"Access Denied","path":"/uaa/users"}

还有堆栈跟踪:

2017-11-15 15:40:11.284 ERROR 9072 --- [nio-6000-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/accounts] threw exception [Request processing failed; nested exception is feign.FeignException: status 403 reading AuthServiceClient#createUser(User); content: {"timestamp":1510753211255,"status":403,"error":"Forbidden","message":"Access Denied","path":"/uaa/users"}] with root cause

由于这似乎是一个 Feign 错误,而 AuthServiceClient.java 似乎是罪魁祸首,我将其包含在此处:

@FeignClient(name = "auth-service")
public interface AuthServiceClient {

@RequestMapping(method = RequestMethod.POST, value = "/uaa/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
void createUser(User user);

}

由于没有对代码进行任何更改,我不明白可能是什么原因以及如何解决此错误。

【问题讨论】:

    标签: java spring oauth-2.0 microservices feign


    【解决方案1】:

    显然有这个神奇的属性让它再次起作用:

    security.oauth2.resource.filter-order: 3 
    

    auth-service.properties

    在此处进一步阅读: SpringBoot 1.5.x + Security + OAuth2

    【讨论】:

      猜你喜欢
      • 2021-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      • 2022-01-09
      • 2018-10-18
      • 2017-07-23
      相关资源
      最近更新 更多