Skip to content

Commit 2aabff8

Browse files
committed
Handle deprecations introduce in cakephp/authentication 3.3.0
1 parent 3b4f37f commit 2aabff8

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

plugins/jwt-auth/tests/test_app/src/Application.php

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,44 +98,45 @@ public function getAuthenticationService(ServerRequestInterface $request): Authe
9898
AbstractIdentifier::CREDENTIAL_USERNAME => 'email',
9999
AbstractIdentifier::CREDENTIAL_PASSWORD => 'password',
100100
],
101-
'loginUrl' => '/test/login.json'
101+
'loginUrl' => '/test/login.json',
102+
'identifier' => [
103+
'Authentication.Password' => [
104+
'fields' => [
105+
AbstractIdentifier::CREDENTIAL_USERNAME => 'email',
106+
AbstractIdentifier::CREDENTIAL_PASSWORD => 'password',
107+
],
108+
'resolver' => [
109+
'className' => 'Authentication.Orm',
110+
'userModel' => 'Users',
111+
],
112+
'passwordHasher' => [
113+
'className' => 'Authentication.Fallback',
114+
'hashers' => [
115+
'Authentication.Default',
116+
[
117+
'className' => 'Authentication.Legacy',
118+
'hashType' => 'md5',
119+
],
120+
],
121+
],
122+
],
123+
],
102124
]);
103125

104-
$service->loadIdentifier('Authentication.JwtSubject');
105-
106126
if (str_starts_with(haystack: $config->getAlg(), needle: 'HS')) {
107127
$service->loadAuthenticator('Authentication.Jwt', [
108128
'secretKey' => $config->getSecret(),
109129
'algorithm' => $config->getAlg(),
130+
'identifier' => 'Authentication.JwtSubject',
110131
]);
111132
} else if (str_starts_with(haystack: $config->getAlg(), needle: 'RS')) {
112133
$service->loadAuthenticator('Authentication.Jwt', [
113134
'jwks' => (new JwkSet)->getKeySet(),
114135
'algorithm' => $config->getAlg(),
136+
'identifier' => 'Authentication.JwtSubject',
115137
]);
116138
}
117139

118-
$service->loadIdentifier('Authentication.Password', [
119-
'fields' => [
120-
AbstractIdentifier::CREDENTIAL_USERNAME => 'email',
121-
AbstractIdentifier::CREDENTIAL_PASSWORD => 'password',
122-
],
123-
'resolver' => [
124-
'className' => 'Authentication.Orm',
125-
'userModel' => 'Users',
126-
],
127-
'passwordHasher' => [
128-
'className' => 'Authentication.Fallback',
129-
'hashers' => [
130-
'Authentication.Default',
131-
[
132-
'className' => 'Authentication.Legacy',
133-
'hashType' => 'md5',
134-
],
135-
],
136-
],
137-
]);
138-
139140
return $service;
140141
}
141142
}

0 commit comments

Comments
 (0)