spring-oauth-server实践:OAuth2.0 通过header 传递 access_token 验证

一、解析查找 access_token

1、OAuth2AuthenticationProcessingFilter.tokenExtractor

2、发现来源可以有两处:请求的头或者请求的参数

二、总结

1、如果使用头信息传递,指定方式::Authorization=bearer0206e73d-3e2b-4886-90ff-1e7edc6b34f5

如:

http://localhost:9000/api-gateway-engine/API/LsqGrp1/LsqVer1/LsqApi1

报文格式:

POST /api-gateway-engine/API/LsqGrp1/LsqVer1/LsqApi1 HTTP/1.1
Host: localhost:9000
Authorization: bearer0206e73d-3e2b-4886-90ff-1e7edc6b34f5
Cache-Control: no-cache
Postman-Token: 2a255144-81ad-7712-7354-e64076e525c2
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW-- 

2、如果使用请求参数传递,指定方式::access_token=0206e73d-3e2b-4886-90ff-1e7edc6b34f5

如:

http://localhost:9000/api-gateway-engine/API/LsqGrp1/LsqVer1/LsqApi1?access_token=0206e73d-3e2b-4886-90ff-1e7edc6b34f5

三、举例

1、DevApp侧

2、api-gateway-engine

原文地址:https://www.cnblogs.com/lexiaofei/p/7203790.html