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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM