File tree 2 files changed +14
-1
lines changed
config/plugin/tinywan/jwt
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,15 @@ private static function getTokenFromHeaders(): string
219
219
{
220
220
$ authorization = request ()->header ('authorization ' );
221
221
if (!$ authorization || 'undefined ' == $ authorization ) {
222
- throw new JwtTokenException ('请求未携带authorization信息 ' );
222
+ $ config = self ::_getConfig ();
223
+ if (!isset ($ config ['is_support_get_token ' ]) || false === $ config ['is_support_get_token ' ]) {
224
+ throw new JwtTokenException ('请求未携带authorization信息 ' );
225
+ }
226
+ $ authorization = request ()->get ($ config ['is_support_get_token_key ' ]);
227
+ if (empty ($ authorization )) {
228
+ throw new JwtTokenException ('请求未携带authorization信息 ' );
229
+ }
230
+ $ authorization = 'Bearer ' .$ authorization ;
223
231
}
224
232
225
233
if (self ::REFRESH_TOKEN != substr_count ($ authorization , '. ' )) {
Original file line number Diff line number Diff line change 47
47
return [];
48
48
},
49
49
50
+ /** 是否支持 get 请求获取令牌 */
51
+ 'is_support_get_token ' => true ,
52
+ /** GET 请求获取令牌请求key */
53
+ 'is_support_get_token_key ' => 'authorization ' ,
54
+
50
55
/** access令牌私钥 */
51
56
'access_private_key ' => <<<EOD
52
57
-----BEGIN RSA PRIVATE KEY-----
You can’t perform that action at this time.
0 commit comments