File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
config/plugin/tinywan/jwt Expand file tree Collapse file tree 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
219219 {
220220 $ authorization = request ()->header ('authorization ' );
221221 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 ;
223231 }
224232
225233 if (self ::REFRESH_TOKEN != substr_count ($ authorization , '. ' )) {
Original file line number Diff line number Diff line change 4747 return [];
4848 },
4949
50+ /** 是否支持 get 请求获取令牌 */
51+ 'is_support_get_token ' => true ,
52+ /** GET 请求获取令牌请求key */
53+ 'is_support_get_token_key ' => 'authorization ' ,
54+
5055 /** access令牌私钥 */
5156 'access_private_key ' => <<<EOD
5257-----BEGIN RSA PRIVATE KEY-----
You can’t perform that action at this time.
0 commit comments