File tree Expand file tree Collapse file tree 2 files changed +2
-24
lines changed
Authentication/Authenticators Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -207,17 +207,14 @@ public function loggedIn(): bool
207207 /** @var IncomingRequest $request */
208208 $ request = service ('request ' );
209209
210- /** @var AuthJWT $config */
211- $ config = config ('AuthJWT ' );
212-
213210 $ token = $ this ->getTokenFromHeader ($ request );
214211
215212 return $ this ->attempt ([
216213 'token ' => $ token ,
217214 ])->isOK ();
218215 }
219216
220- private function getTokenFromHeader (RequestInterface $ request ): string
217+ public function getTokenFromHeader (RequestInterface $ request ): string
221218 {
222219 assert ($ request instanceof IncomingRequest);
223220
Original file line number Diff line number Diff line change 1919use CodeIgniter \HTTP \Response ;
2020use CodeIgniter \HTTP \ResponseInterface ;
2121use CodeIgniter \Shield \Authentication \Authenticators \JWT ;
22- use CodeIgniter \Shield \Config \AuthJWT ;
2322use Config \Services ;
2423
2524/**
@@ -45,7 +44,7 @@ public function before(RequestInterface $request, $arguments = null)
4544 /** @var JWT $authenticator */
4645 $ authenticator = auth ('jwt ' )->getAuthenticator ();
4746
48- $ token = $ this ->getTokenFromHeader ($ request );
47+ $ token = $ authenticator ->getTokenFromHeader ($ request );
4948
5049 $ result = $ authenticator ->attempt (['token ' => $ token ]);
5150
@@ -62,24 +61,6 @@ public function before(RequestInterface $request, $arguments = null)
6261 }
6362 }
6463
65- private function getTokenFromHeader (RequestInterface $ request ): string
66- {
67- assert ($ request instanceof IncomingRequest);
68-
69- /** @var AuthJWT $config */
70- $ config = config ('AuthJWT ' );
71-
72- $ tokenHeader = $ request ->getHeaderLine (
73- $ config ->authenticatorHeader ?? 'Authorization '
74- );
75-
76- if (strpos ($ tokenHeader , 'Bearer ' ) === 0 ) {
77- return trim (substr ($ tokenHeader , 6 ));
78- }
79-
80- return $ tokenHeader ;
81- }
82-
8364 /**
8465 * We don't have anything to do here.
8566 *
You can’t perform that action at this time.
0 commit comments