@@ -36,6 +36,14 @@ protected function resloveConfig()
3636 $ this ->config = new Config ($ options );
3737 }
3838
39+ /**
40+ * @var Config
41+ */
42+ public function getConfig ()
43+ {
44+ return $ this ->config ;
45+ }
46+
3947 public function login (Token $ token ): void
4048 {
4149 if ($ this ->app ->get ('jwt.sso ' )->getEnable ()) {
@@ -47,31 +55,30 @@ public function login(Token $token): void
4755
4856 protected function handleSSO (Token $ token ): void
4957 {
50- $ jti = $ token ->getClaim ('jti ' );
51- $ store = $ token ->getClaim ('store ' );
52- $ exp = $ token ->getClaim ('exp ' ) - time ();
58+ $ jti = $ token ->claims ()->get ('jti ' );
59+ $ store = $ token ->claims ()->get ()('store ' );
5360
5461 $ this ->destroyToken ($ jti , $ store );
5562 }
5663
5764 protected function pushWhitelist (Token $ token ): void
5865 {
59- $ jti = $ token ->getClaim ('jti ' );
60- $ store = $ token ->getClaim ('store ' );
61- $ exp = $ token ->getClaim ('exp ' ) - time ();
62- $ tag = $ store .'- ' . $ this ->config ->getWhitelist ();
66+ $ jti = $ token ->claims ()-> get ('jti ' );
67+ $ store = $ token ->claims ()-> get ('store ' );
68+ $ exp = $ token ->claims ()-> get ('exp ' ) - time ();
69+ $ tag = $ store . '- ' . $ this ->config ->getWhitelist ();
6370
6471 $ key = $ this ->formatKey ($ store , $ this ->config ->getWhitelist (), $ jti , (string )$ token );
6572 $ this ->setCache ($ tag , $ key , (string )$ token , $ exp );
6673 }
6774
6875 protected function pushBlacklist (Token $ token ): void
6976 {
70- $ jti = $ token ->getClaim ('jti ' );
71- $ store = $ token ->getClaim ('store ' );
77+ $ jti = $ token ->claims ()-> get ('jti ' );
78+ $ store = $ token ->claims ()-> get ('store ' );
7279
73- $ exp = $ token ->getClaim ('exp ' ) - time ();
74- $ tag = $ store .'- ' . $ this ->config ->getBlacklist ();
80+ $ exp = $ token ->claims ()-> get ('exp ' ) - time ();
81+ $ tag = $ store . '- ' . $ this ->config ->getBlacklist ();
7582 $ key = $ this ->formatKey ($ store , $ this ->config ->getBlacklist (), $ jti , (string )$ token );
7683
7784 $ this ->setCache ($ tag , $ key , (string )$ token , $ exp );
@@ -84,15 +91,15 @@ public function logout(Token $token): void
8491
8592 public function wasBan (Token $ token ): bool
8693 {
87- $ jti = $ token ->getClaim ('jti ' );
88- $ store = $ token ->getClaim ('store ' );
94+ $ jti = $ token ->claims ()-> get ('jti ' );
95+ $ store = $ token ->claims ()-> get ('store ' );
8996
90- return $ this ->getBlacklist ($ store , $ jti , ( string ) $ token ) === ( string ) $ token ? true : false ;
97+ return $ this ->getBlacklist ($ store , $ jti , $ token ) === $ token-> toString () ;
9198 }
9299
93- protected function getBlacklist (string $ store , string $ jti , string $ token )
100+ protected function getBlacklist (string $ store , string $ jti , Token $ token )
94101 {
95- return $ this ->getCache ($ store , $ this ->config ->getBlacklist (), $ jti , $ token );
102+ return $ this ->getCache ($ store , $ this ->config ->getBlacklist (), $ jti , $ token-> toString () );
96103 }
97104
98105 public function destroyStoreWhitelist ($ store ): void
@@ -108,14 +115,13 @@ public function destroyStoreBlacklist($store): void
108115 public function destroyToken ($ id , $ store ): void
109116 {
110117 $ type = $ this ->config ->getWhitelist ();
111- $ tag = $ store .'- ' . $ type ;
118+ $ tag = $ store . '- ' . $ type ;
112119
113120 $ rule = implode (': ' , [$ this ->config ->getPrefix (), $ store , $ type , $ id ]);
114121 $ keys = $ this ->app ->cache ->getTagItems ($ tag );
115122 $ parser = new Parser ();
116123
117- foreach ($ keys as $ key ) {
118-
124+ foreach ($ keys as $ key ) {
119125 if (false !== strpos ($ key , $ rule )) {
120126 $ value = $ this ->app ->cache ->get ($ key );
121127
0 commit comments