File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,22 +30,23 @@ public function __construct(App $app)
3030 public function get ($ handle ): string
3131 {
3232 if (is_string ($ handle )) {
33- if (!in_array ($ handle , $ this ->handles )) {
34- throw new JwtException ('不支持此方式获取. ' , 500 );
35- }
36- } else if (is_array ($ handle ) && !empty ($ handle )) {
37- $ handles = $ handle ;
38- foreach ($ handles as $ item ) {
39- if (in_array ($ item , $ this ->handles )) {
40- $ handle = $ item ;
41- continue ;
33+ $ handles = explode ('| ' , $ handle );
34+ }
35+
36+ foreach ($ handles as $ handle ) {
37+ if (in_array ($ handle , $ this ->handles )) {
38+ $ namespace = '\\xiaodi \\JWTAuth\Handle \\' . $ handle ;
39+ $ token = (new $ namespace ($ this ->app ))->handle ();
40+ if ($ token ) {
41+ $ this ->token = $ token ;
42+ break ;
4243 }
44+ continue ;
45+ } else {
46+ throw new JwtException ('不支持此方式获取. ' , 500 );
4347 }
4448 }
4549
46- $ namespace = '\\xiaodi \\JWTAuth\Handle \\' . $ handle ;
47- $ this ->token = (new $ namespace ($ this ->app ))->handle ();
48-
4950 if (!$ this ->token ) {
5051 throw new JwtException ('获取Token失败. ' , 500 );
5152 }
You can’t perform that action at this time.
0 commit comments