Skip to content

Commit 4617ee9

Browse files
authored
Merge branch '13.next-cake4' into feature/manage-null-reference
2 parents e1fb276 + f8c1876 commit 4617ee9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2272
-195
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ on:
99

1010
jobs:
1111
testsuite:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-version: ['7.3', '7.4', '8.0', '8.1']
16+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
1717
db-type: [sqlite, mysql, pgsql]
1818
prefer-lowest: ['']
1919

@@ -79,15 +79,15 @@ jobs:
7979

8080
cs-stan:
8181
name: Coding Standard & Static Analysis
82-
runs-on: ubuntu-20.04
82+
runs-on: ubuntu-22.04
8383

8484
steps:
8585
- uses: actions/checkout@v2
8686

8787
- name: Setup PHP
8888
uses: shivammathur/setup-php@v2
8989
with:
90-
php-version: '7.3'
90+
php-version: '7.4'
9191
extensions: mbstring, intl, apcu
9292
coverage: none
9393

@@ -117,4 +117,4 @@ jobs:
117117

118118
- name: Run phpstan
119119
if: success() || failure()
120-
run: composer stan
120+
run: composer stan

.semver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
:major: 11
3-
:minor: 2
3+
:minor: 3
44
:patch: 0
55
:special: ''

CHANGELOG.md

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,61 @@
11
Changelog
22
=========
3+
Releases for CakePHP 4.5
4+
------------------------
5+
* 13.0.0
6+
* Set dependecy for CakeDC/Auth to 9.0. Perform 2FA refactoring,
37

4-
Releases for CakePHP 4
5-
-------------
8+
* 11.3.5
9+
* Update ci.yml with php8.2 and php8.3
10+
* fix: minor fix on last_login datetime format
11+
* Update Permissions.md
12+
* fix: config for updateLastLogin
13+
* fix: remove deprecated code on profile logic
14+
* feat:flash message on login, on cake4
15+
16+
* 11.3.4
17+
* Fix `Detected invalid UTF-8 for field...` issue when storing session data from `Webauthn` in a mongo database.
18+
19+
* 11.3.3
20+
* Add display of unauthorized url in flash message when debug is true
21+
22+
* 11.3.2
23+
* Improve documentation, coding standards
24+
25+
* 11.3.1
26+
* Merge changes from diverged branches, including link generator and keep CakePHP 4.5 compatibility
27+
28+
* 11.3.0
29+
* Require CakePHP ^4.5
30+
31+
Releases for CakePHP 4.4
32+
------------------------
33+
* 11.2.5
34+
* Fix failed tests and code standards
35+
36+
* 11.2.4
37+
* Fix dependencies, require CakePHP 4.4.*
38+
39+
* 11.2.3
40+
* Improved documentation
41+
* Deprecate (broken) compatibility with Linkedin Oauth based connector, they only provide compatibility with OpenID Connect now
42+
* Add Dutch translation by Stefan
43+
* Add `linkGenerator` for emails, useful for API driven apps
44+
* Fix CakePHP 4.5 deprecations
45+
* Fix webauthn loading issues
46+
47+
* 11.2.2
48+
* Fix issue with password rehash with a custom password field
49+
50+
* 11.2.1
51+
* Use UsersUrl and unify url building for login action
52+
53+
* 11.2.0
54+
* Feature/microsoft login by @arodu in #1000
55+
* Add more events into login component (before login, after login failure) by @rochamarcelo in #1007
56+
57+
* 11.1.1
58+
* Use url builder for login redirect
659

760
* 11.1.0
861
* German (de) by @LordSimal
@@ -12,6 +65,22 @@ Releases for CakePHP 4
1265
* Switched tests to new cakephp schema
1366
* Update to PHPUnit 9.5
1467

68+
* There are NO tags for 10.x we jumped from 9.x to 11.x
69+
70+
Releases for CakePHP 4
71+
----------------------
72+
* 9.3.1
73+
* Add CI tests for PHP 8.1
74+
* Add events `EVENT_BEFORE_LOGIN`, `EVENT_AFTER_LOGIN_FAILURE`
75+
76+
* 9.3.0
77+
* Improve documentation
78+
* Add webauthn as two factor authentication
79+
80+
* 9.2.1
81+
* Improve documentation
82+
* Fix change password issue
83+
1584
* 9.2.0
1685
* Switch to github actions
1786
* New event AfterEmailTokenValidation
@@ -30,7 +99,7 @@ Releases for CakePHP 4
3099
* Ukrainian (uk) by @yarkm13
31100
* Docs improvements
32101
* Fix DebugKit permissions issues
33-
102+
34103
* 9.0.2
35104
* Added a custom Unauthorized Handler
36105
* If logged user access unauthorized url he is redirected to referer url or '/' if no referer url
@@ -54,9 +123,13 @@ Releases for CakePHP 4
54123
* Migrated usage of AuthComponent to Authorization/Authentication plugins.
55124

56125
Releases for CakePHP 3
57-
-------------
126+
----------------------
127+
* 8.5.2
128+
* Add optional merge configuration option
129+
58130
* 8.5.1
59131
* Added new `UsersAuthComponent::EVENT_SOCIAL_LOGIN_EXISTING_ACCOUNT`
132+
60133
* 8.5.0
61134
* Added new `UsersAuthComponent::EVENT_BEFORE_SOCIAL_LOGIN_REDIRECT`
62135
* Added finder to get existing social account
@@ -72,10 +145,10 @@ Releases for CakePHP 3
72145
* 8.2.1
73146
* Fix scope in facebook social login
74147

75-
* 8.2
148+
* 8.2.0
76149
* Removed deprecations for CakePHP 3.7
77150

78-
* 8.1
151+
* 8.1.0
79152
* Added Yubico U2F Authentication
80153

81154
* 8.0.3
@@ -222,7 +295,7 @@ Releases for CakePHP 3
222295
* Link social accounts in profile
223296

224297
Releases for CakePHP 2
225-
-------------
298+
----------------------
226299

227300
* 2.1.3
228301
* Fixed unit tests for compatibility with CakePHP 2.7

Docs/Documentation/Authentication.md

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Authentication
22
==============
3-
This plugin uses the new authentication plugin [cakephp/authentication](https://github.com/cakephp/authentication/)
3+
4+
This plugin uses the new CakePHP Authentication plugin [cakephp/authentication](https://github.com/cakephp/authentication/)
45
instead of CakePHP Authentication component, but don't worry, the default configuration should be enough for your
56
projects.
67

@@ -9,11 +10,11 @@ We've tried to simplify configuration as much as possible using defaults, but ke
910
Authentication Component
1011
------------------------
1112

12-
The default behavior is to load the authentication component at UsersController,
13-
defining the default urls for loginAction, loginRedirect, logoutRedirect but not requiring
14-
the request to have a identity.
13+
The default behavior is to load the authentication component at ``UsersController``,
14+
defining the default URLs for ``loginAction``, ``loginRedirect``, ``logoutRedirect`` but not requiring
15+
the request to have an identity.
1516

16-
If you prefer to load the component yourself you can set 'Auth.AuthenticationComponent.load':
17+
If you prefer to load the component yourself you can set ``Auth.AuthenticationComponent.load``:
1718

1819
```
1920
Configure:write('Auth.AuthenticationComponent.load', false);
@@ -27,7 +28,8 @@ $this->loadComponent('Authentication.Authentication', $authenticationConfig);
2728
$userId = $this->Authentication->getIdentity()->getIdentifier();
2829
$user = $this->Authentication->getIdentity()->getOriginalData();
2930
```
30-
The default configuration for Auth.AuthenticationComponent is:
31+
32+
The default configuration for ``Auth.AuthenticationComponent`` is:
3133

3234
```php
3335
[
@@ -37,28 +39,30 @@ The default configuration for Auth.AuthenticationComponent is:
3739
]
3840
```
3941

40-
[Check the component options at the it's source code for more infomation](https://github.com/cakephp/authentication/blob/master/src/Controller/Component/AuthenticationComponent.php#L38)
42+
Check [the component options at the its source code](https://github.com/cakephp/authentication/blob/master/src/Controller/Component/AuthenticationComponent.php#L38) for more infomation.
4143

4244
Authenticators
4345
--------------
4446

45-
The cakephp/authentication plugin provides the main structure for the authenticators used in this plugin,
47+
The ``cakephp/authentication`` plugin provides the main structure for the authenticators used in this plugin,
4648
we also use some custom authenticators to work with social providers, reCaptcha and cookie. The default
4749
list of authenticators includes:
4850

49-
- 'Authentication.Session'
50-
- 'CakeDC/Auth.Form'
51-
- 'Authentication.Token'
52-
- 'CakeDC/Auth.Cookie'
53-
- 'CakeDC/Users.Social'//Works with SocialAuthMiddleware
54-
- 'CakeDC/Users.SocialPendingEmail'
51+
- ``Authentication.Session``
52+
- ``CakeDC/Auth.Form``
53+
- ``Authentication.Token``
54+
- ``CakeDC/Auth.Cookie``
55+
- ``CakeDC/Users.Social`` which works with the ``SocialAuthMiddleware``
56+
- ``CakeDC/Users.SocialPendingEmail``
57+
58+
If you enable ``OneTimePasswordAuthenticator.login`` we also load the ``CakeDC/Auth.TwoFactor``
5559

56-
**If you enable 'OneTimePasswordAuthenticator.login' we also load the CakeDC/Auth.TwoFactor**
60+
These authenticators should be enough for your application, but you can easily customize it
61+
setting the ``Auth.Authenticators`` config key.
5762

58-
These authenticators should be enough for your application, but you easily customize it
59-
setting the Auth.Authenticators config key.
63+
These authenticators are loaded by the ``\CakeDC\Users\Loader\AuthenticationServiceLoader`` class in the ``loadAuthenticators`` method. See [Authentication Service Loader](#authentication-service-loader) on how to adjust it to your needs.
6064

61-
For example if you add JWT authenticator you must add this to your config/users.php file:
65+
For example, if you want to add the JWT authenticator you must add the following to your ``config/users.php`` file:
6266

6367
```php
6468
'Auth.Authenticators.Jwt' => [
@@ -68,26 +72,20 @@ For example if you add JWT authenticator you must add this to your config/users.
6872
],
6973
```
7074

71-
**You may have noticed the 'skipTwoFactorVerify' option, this option is used to identify if a authenticator should skip
72-
the two factor flow**
73-
74-
The authenticators are loaded by \CakeDC\Users\Loader\AuthenticationServiceLoader class at load authentication
75-
service method from plugin object.
76-
77-
See the full Auth.Authenticators at config/users.php
75+
The ``skipTwoFactorVerify`` option is used to skip the two factor flow for a given authenticator
7876

7977
Identifiers
8078
-----------
81-
The identifies are defined to work correctly with the default authenticators, we are using these identifiers:
8279

83-
- Authentication.Password, for Form authenticator
84-
- CakeDC/Users.Social, for Social and SocialPendingEmail authenticators
85-
- Authentication.Token, for TokenAuthenticator
80+
The identifiers are defined to work correctly with the default authenticators, we are using these identifiers:
8681

87-
As you add more authenticators you may need to add identifiers, please check identifiers available at
88-
[official documentation](https://github.com/cakephp/authentication/blob/master/docs/Identifiers.md)
82+
- ``Authentication.Password``, for ``Form`` authenticator
83+
- ``CakeDC/Users.Social``, for ``Social`` and ``SocialPendingEmail`` authenticators
84+
- ``Authentication.Token``, for ``Token`` authenticator
8985

90-
The default value for Auth.Identifiers is:
86+
As you add more authenticators you may also need to add other identifiers, please see [the identifiers available in the official CakePHP Authentication plugin documentation](https://book.cakephp.org/authentication/2/en/identifiers.html).
87+
88+
The default list for ``Auth.Identifiers`` is:
9189

9290
```php
9391
[
@@ -116,24 +114,25 @@ The default value for Auth.Identifiers is:
116114
]
117115
]
118116
```
119-
The identifiers are loaded by \CakeDC\Users\Loader\AuthenticationServiceLoader class at load authentication
120-
service method from plugin object.
121117

118+
These identifiers are loaded by the ``\CakeDC\Users\Loader\AuthenticationServiceLoader`` class in the ``loadIdentifiers`` method. See [Authentication Service Loader](#authentication-service-loader) on how to adjust it to your needs.
122119

123120
Handling Login Result
124121
---------------------
125-
For both form login and social login we use a base component 'CakeDC/Users.Login' to handle login,
126-
it check the result of authentication service to redirect user to a internal page or show an authentication
127-
error. It provide some error messages for specific authentication result status, please check the config/users.php file.
128122

129-
To use a custom component to handle the login you should update your config/users.php file with:
123+
For both form login and social login we use a base component ``CakeDC/Users.Login`` to handle the login.
124+
It checks the result of the authentication service and either redirects the user or shows an authentication
125+
error. It provides some error messages for specific authentication results. Please check the ``config/users.php`` file.
126+
127+
To use a custom component to handle the login you should update your ``config/users.php`` file with:
130128

131129
```php
132130
'Auth.SocialLoginFailure.component' => 'MyLoginA',
133131
'Auth.FormLoginFailure.component' => 'MyLoginB',
134132
```
135133

136-
The default configuration are:
134+
The default configuration is:
135+
137136
```php
138137
[
139138
...
@@ -169,13 +168,14 @@ The default configuration are:
169168

170169
Authentication Service Loader
171170
-----------------------------
172-
To make the integration with cakephp/authentication easier we load the authenticators and identifiers
173-
defined at Auth configuration and other components to work with social provider, two-factor authentication.
174171

175-
If the configuration is not enough for your project you may create a custom loader extending the
176-
default provided.
172+
To make the integration with CakePHP Authenication plugin easier we load the authenticators and identifiers
173+
defined at the ``Auth`` configuration key.
177174

178-
- Create file src/Loader/AppAuthenticationServiceLoader.php
175+
If the default configuration is not enough for your project's needs you may create a custom loader extending the
176+
default loader provided.
177+
178+
For example, create a file ``src/Loader/AppAuthenticationServiceLoader.php``:
179179

180180
```php
181181
<?php
@@ -202,7 +202,8 @@ class AppAuthenticationServiceLoader extends AuthenticationServiceLoader
202202
}
203203
}
204204
```
205-
- Add this to your config/users.php file to change the authentication service loader:
205+
206+
Add the following to your ``config/users.php`` configuration to change the authentication service loader:
206207

207208
```php
208209
'Auth.Authentication.serviceLoader' => \App\Loader\AppAuthenticationServiceLoader::class,

Docs/Documentation/Authorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ If you don't want the plugin to autoload setup authorization, you can disable
1010
in your config/users.php with:
1111

1212
```php
13-
'Auth.Authorization.enabled' => false,
13+
'Auth.Authorization.enable' => false,
1414
```
1515

1616
Authorization Middleware

Docs/Documentation/Extending-the-Plugin.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ use CakeDC\Users\Model\Table\UsersTable;
2222
*/
2323
class MyUsersTable extends UsersTable
2424
{
25+
// important, you'll need to override the alias if you extend from an existing table
26+
public function initialize(array $config): void
27+
{
28+
parent::initialize($config);
29+
30+
$this->setAlias('MyUsers');
31+
}
2532
}
2633
```
2734

Docs/Documentation/Installation.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ If you want to use social login features...
1414
composer require league/oauth2-facebook:@stable
1515
composer require league/oauth2-instagram:@stable
1616
composer require league/oauth2-google:@stable
17-
composer require league/oauth2-linkedin:@stable
1817
composer require league/oauth1-client:@stable
1918
```
2019

@@ -106,7 +105,7 @@ section to check all the customization options
106105
You can create the first user, the super user by issuing the following command
107106

108107
```
109-
bin/cake users addSuperuser
108+
bin/cake users add_superuser
110109
```
111110

112111
Customization

0 commit comments

Comments
 (0)