@@ -105,16 +105,20 @@ For LDAP authentication:
105105 LdapIdentifier::CREDENTIAL_PASSWORD => 'password',
106106 ];
107107
108- URL Checker Renamed
109- -------------------
108+ URL Checker Renamed and Restructured
109+ -------------------------------------
110110
111- ``CakeRouterUrlChecker `` has been renamed to ``CakeUrlChecker `` and now accepts
112- both string and array URLs (just like ``Router::url() ``).
111+ URL checkers have been completely restructured:
112+
113+ - ``CakeRouterUrlChecker `` has been renamed to ``DefaultUrlChecker ``
114+ - The old ``DefaultUrlChecker `` (framework-agnostic) has been renamed to ``GenericUrlChecker ``
115+ - Auto-detection has been removed - ``DefaultUrlChecker `` is now hardcoded
113116
114117**Before (3.x): **
115118
116119.. code-block :: php
117120
121+ // Using CakeRouterUrlChecker explicitly
118122 $service->loadAuthenticator('Authentication.Form', [
119123 'urlChecker' => 'Authentication.CakeRouter',
120124 'loginUrl' => [
@@ -123,25 +127,33 @@ both string and array URLs (just like ``Router::url()``).
123127 ],
124128 ]);
125129
130+ // Using DefaultUrlChecker explicitly (framework-agnostic)
131+ $service->loadAuthenticator('Authentication.Form', [
132+ 'urlChecker' => 'Authentication.Default',
133+ 'loginUrl' => '/users/login',
134+ ]);
135+
136+ // Auto-detection (picks CakeRouter if available, otherwise Default)
137+ $service->loadAuthenticator('Authentication.Form', [
138+ 'loginUrl' => '/users/login',
139+ ]);
140+
126141 **After (4.x): **
127142
128143.. code-block :: php
129144
130- // CakeUrlChecker is now the default when CakePHP is installed
145+ // DefaultUrlChecker is now hardcoded (formerly CakeRouterUrlChecker)
131146 $service->loadAuthenticator('Authentication.Form', [
132147 'loginUrl' => [
133148 'controller' => 'Users',
134149 'action' => 'login',
135150 ],
136151 ]);
137152
138- // Or explicitly:
153+ // For framework-agnostic projects, explicitly use GenericUrlChecker
139154 $service->loadAuthenticator('Authentication.Form', [
140- 'urlChecker' => 'Authentication.Cake',
141- 'loginUrl' => [
142- 'controller' => 'Users',
143- 'action' => 'login',
144- ],
155+ 'urlChecker' => 'Authentication.Generic',
156+ 'loginUrl' => '/users/login',
145157 ]);
146158
147159 Simplified URL Checker API
@@ -189,31 +201,38 @@ Single URLs work the same in both versions:
189201 'loginUrl' => ['controller' => 'Users', 'action' => 'login'],
190202 ]);
191203
192- Auto-Detection Changes
204+ Auto-Detection Removed
193205----------------------
194206
195207URL Checkers
196208^^^^^^^^^^^^
197209
198- - When CakePHP Router is available: defaults to ``CakeUrlChecker ``
199- - Without CakePHP: defaults to ``DefaultUrlChecker ``
200- - For multiple URLs: you **must ** explicitly configure ``MultiUrlChecker ``
210+ **Important: ** Auto-detection has been removed. ``DefaultUrlChecker `` is now hardcoded
211+ and assumes CakePHP is available.
212+
213+ - **4.x default: ** Always uses ``DefaultUrlChecker `` (formerly ``CakeUrlChecker ``)
214+ - **Framework-agnostic: ** Must explicitly configure ``GenericUrlChecker ``
215+ - **Multiple URLs: ** Must explicitly configure ``MultiUrlChecker ``
201216
202- DefaultUrlChecker Changes
203- ^^^^^^^^^^^^^^^^^^^^^^^^^
217+ DefaultUrlChecker is Now CakePHP-Based
218+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
204219
205- ``DefaultUrlChecker `` no longer accepts array-based URLs. It throws a
206- ``RuntimeException `` if an array URL is provided:
220+ ``DefaultUrlChecker `` is now the CakePHP checker (formerly ``CakeRouterUrlChecker ``).
221+ It requires CakePHP Router and supports both string and array URLs.
222+
223+ The 3.x framework-agnostic ``DefaultUrlChecker `` has been renamed to ``GenericUrlChecker ``.
207224
208225.. code-block :: php
209226
210- // This will throw an exception in 4.x
227+ // DefaultUrlChecker now requires CakePHP Router
211228 $checker = new DefaultUrlChecker();
212- $checker->check($request, ['controller' => 'Users', 'action' => 'login']);
229+ $checker->check($request, ['controller' => 'Users', 'action' => 'login']); // Works
230+ $checker->check($request, '/users/login'); // Also works
213231
214- // Use CakeUrlChecker instead:
215- $checker = new CakeUrlChecker();
216- $checker->check($request, ['controller' => 'Users', 'action' => 'login']);
232+ // For framework-agnostic usage:
233+ $checker = new GenericUrlChecker();
234+ $checker->check($request, '/users/login'); // Works
235+ $checker->check($request, ['controller' => 'Users']); // Throws exception
217236
218237 New Features
219238============
@@ -264,20 +283,33 @@ Migration Tips
264283
265284 - ``AbstractIdentifier::CREDENTIAL_ `` → ``PasswordIdentifier::CREDENTIAL_ ``
266285 - ``IdentifierCollection `` → ``IdentifierFactory ``
267- - ``'Authentication.CakeRouter' `` → ``'Authentication.Cake' ``
268- - ``CakeRouterUrlChecker `` → ``CakeUrlChecker ``
286+ - ``'Authentication.CakeRouter' `` → Remove (no longer needed, default is now CakePHP-based)
287+ - ``CakeRouterUrlChecker `` → ``DefaultUrlChecker ``
288+ - Old 3.x ``DefaultUrlChecker `` (framework-agnostic) → ``GenericUrlChecker ``
289+
290+ 2. **Framework-Agnostic Projects **:
291+
292+ If you're using this library without CakePHP, you **must ** explicitly configure
293+ ``GenericUrlChecker ``:
294+
295+ .. code-block :: php
296+
297+ $service->loadAuthenticator('Authentication.Form', [
298+ 'urlChecker' => 'Authentication.Generic',
299+ 'loginUrl' => '/users/login',
300+ ]);
269301
270- 2 . **Multiple Login URLs **:
302+ 3 . **Multiple Login URLs **:
271303
272304 If you have multiple login URLs, add ``'urlChecker' => 'Authentication.Multi' ``
273305 to your authenticator configuration.
274306
275- 3 . **Custom Identifier Setup **:
307+ 4 . **Custom Identifier Setup **:
276308
277309 If you were passing ``IdentifierCollection `` to authenticators, switch to
278310 either passing a single identifier or null (to use defaults).
279311
280- 4 . **Test Thoroughly **:
312+ 5 . **Test Thoroughly **:
281313
282314 The changes to identifier management and URL checking are significant.
283315 Test all authentication flows after upgrading.
0 commit comments