@@ -139,8 +139,8 @@ Add the following to your ``Application`` class::
139139 {
140140 $service = new AuthenticationService();
141141 // ...
142- $service->loadIdentifier('Authentication.JwtSubject');
143142 $service->loadAuthenticator('Authentication.Jwt', [
143+ 'identifier' => 'Authentication.JwtSubject',
144144 'secretKey' => file_get_contents(CONFIG . '/jwt.key'),
145145 'algorithm' => 'RS256',
146146 'returnPayload' => false
@@ -180,7 +180,6 @@ Using a JWKS fetched from an external JWKS endpoint is supported as well::
180180 {
181181 $service = new AuthenticationService();
182182 // ...
183- $service->loadIdentifier('Authentication.JwtSubject');
184183
185184 $jwksUrl = 'https://appleid.apple.com/auth/keys';
186185
@@ -193,6 +192,7 @@ Using a JWKS fetched from an external JWKS endpoint is supported as well::
193192 });
194193
195194 $service->loadAuthenticator('Authentication.Jwt', [
195+ 'identifier' => 'Authentication.JwtSubject',
196196 'jwks' => $jsonWebKeySet,
197197 'returnPayload' => false
198198 ]);
@@ -335,14 +335,18 @@ authentication cookie is **also destroyed**. An example configuration would be::
335335 // Put form authentication first so that users can re-login via
336336 // the login form if necessary.
337337 $service->loadAuthenticator('Authentication.Form', [
338+ 'identifier' => 'Authentication.Password',
338339 'fields' => $fields,
339340 'loginUrl' => '/users/login',
340341 ]);
341342 // Then use sessions if they are active.
342- $service->loadAuthenticator('Authentication.Session');
343+ $service->loadAuthenticator('Authentication.Session', [
344+ 'identifier' => 'Authentication.Password',
345+ ]);
343346
344347 // If the user is on the login page, check for a cookie as well.
345348 $service->loadAuthenticator('Authentication.Cookie', [
349+ 'identifier' => 'Authentication.Password',
346350 'fields' => $fields,
347351 'loginUrl' => '/users/login',
348352 ]);
@@ -366,12 +370,15 @@ and similar SAML 1.1 implementations. An example configuration is::
366370
367371 // Configure a token identifier that maps `USER_ID` to the
368372 // username column
369- $service->loadIdentifier('Authentication.Token', [
370- 'tokenField' => 'username',
371- 'dataField' => 'USER_NAME',
372- ]);
373+ $identifier = [
374+ 'Authentication.Token' => [
375+ 'tokenField' => 'username',
376+ 'dataField' => 'USER_NAME',
377+ ],
378+ ];
373379
374380 $service->loadAuthenticator('Authentication.Environment', [
381+ 'identifier' => $identifier,
375382 'loginUrl' => '/sso',
376383 'fields' => [
377384 // Choose which environment variables exposed by your
@@ -477,19 +484,26 @@ authenticators must send specific challenge headers in the response::
477484 // Instantiate the service
478485 $service = new AuthenticationService();
479486
480- // Load identifiers
481- $service->loadIdentifier('Authentication.Password', [
482- 'fields' => [
483- 'username' => 'email',
484- 'password' => 'password'
485- ]
486- ]);
487- $service->loadIdentifier('Authentication.Token');
487+ // Define identifiers
488+ $passwordIdentifier = [
489+ 'Authentication.Password' => [
490+ 'fields' => [
491+ 'username' => 'email',
492+ 'password' => 'password'
493+ ]
494+ ],
495+ ];
488496
489497 // Load the authenticators leaving Basic as the last one.
490- $service->loadAuthenticator('Authentication.Session');
491- $service->loadAuthenticator('Authentication.Form');
492- $service->loadAuthenticator('Authentication.HttpBasic');
498+ $service->loadAuthenticator('Authentication.Session', [
499+ 'identifier' => $passwordIdentifier,
500+ ]);
501+ $service->loadAuthenticator('Authentication.Form', [
502+ 'identifier' => $passwordIdentifier,
503+ ]);
504+ $service->loadAuthenticator('Authentication.HttpBasic', [
505+ 'identifier' => 'Authentication.Token',
506+ ]);
493507
494508If you want to combine ``HttpBasic `` or ``HttpDigest `` with other
495509authenticators, be aware that these authenticators will abort the request and
0 commit comments