diff --git a/src/Authentication/Authenticators/JWT.php b/src/Authentication/Authenticators/JWT.php index c223bdbc7..09590275c 100644 --- a/src/Authentication/Authenticators/JWT.php +++ b/src/Authentication/Authenticators/JWT.php @@ -61,7 +61,8 @@ public function __construct(UserModel $provider) */ public function attempt(array $credentials): Result { - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); /** @var IncomingRequest $request */ $request = service('request'); @@ -142,7 +143,7 @@ public function check(array $credentials): Result 'success' => false, 'reason' => lang( 'Auth.noToken', - [config(AuthJWT::class)->authenticatorHeader] + [config('AuthJWT')->authenticatorHeader] ), ]); } @@ -196,7 +197,8 @@ public function loggedIn(): bool /** @var IncomingRequest $request */ $request = service('request'); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); return $this->attempt([ 'token' => $request->getHeaderLine($config->authenticatorHeader), diff --git a/src/Authentication/JWT/Adapters/FirebaseAdapter.php b/src/Authentication/JWT/Adapters/FirebaseAdapter.php index 3a246ed3f..70141393d 100644 --- a/src/Authentication/JWT/Adapters/FirebaseAdapter.php +++ b/src/Authentication/JWT/Adapters/FirebaseAdapter.php @@ -79,7 +79,8 @@ public function decode(string $encodedToken, $keyset): stdClass */ private function createKeysForDecode($keyset) { - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $configKeys = $config->keys[$keyset]; @@ -127,7 +128,8 @@ public function encode(array $payload, $keyset, ?array $headers = null): string */ private function createKeysForEncode($keyset): array { - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); if (isset($config->keys[$keyset][0]['secret'])) { $key = $config->keys[$keyset][0]['secret']; diff --git a/src/Authentication/JWT/JWSEncoder.php b/src/Authentication/JWT/JWSEncoder.php index 327d5ea03..e426e7eda 100644 --- a/src/Authentication/JWT/JWSEncoder.php +++ b/src/Authentication/JWT/JWSEncoder.php @@ -39,7 +39,8 @@ public function encode( 'Cannot pass $claims[\'exp\'] and $ttl at the same time.' ); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $payload = array_merge( $config->defaultClaims, diff --git a/src/Filters/JWTAuth.php b/src/Filters/JWTAuth.php index a0a6c2a7d..84914511b 100644 --- a/src/Filters/JWTAuth.php +++ b/src/Filters/JWTAuth.php @@ -59,7 +59,8 @@ private function getTokenFromHeader(RequestInterface $request): string { assert($request instanceof IncomingRequest); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $tokenHeader = $request->getHeaderLine( $config->authenticatorHeader ?? 'Authorization' diff --git a/src/Models/BaseModel.php b/src/Models/BaseModel.php index c266a6070..e0db1dec1 100644 --- a/src/Models/BaseModel.php +++ b/src/Models/BaseModel.php @@ -20,7 +20,7 @@ abstract class BaseModel extends Model public function __construct() { - $this->authConfig = config(Auth::class); + $this->authConfig = config('Auth'); if ($this->authConfig->DBGroup !== null) { $this->DBGroup = $this->authConfig->DBGroup;