File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 3434 },
3535 "require-dev" : {
3636 "cakephp/cakephp-codesniffer" : " ^4.0" ,
37- "phpunit/phpunit" : " ~8.5.0"
37+ "phpunit/phpunit" : " ~8.5.0" ,
38+ "cakephp/authentication" : " ^2.3"
3839 },
3940 "scripts" : {
4041 "cs-check" : " phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/" ,
Original file line number Diff line number Diff line change 33
44namespace Muffin \Footprint \Auth ;
55
6+ use Authentication \IdentityInterface ;
67use Cake \Datasource \EntityInterface ;
78use Cake \Event \EventInterface ;
89use Cake \Event \EventManager ;
910use Muffin \Footprint \Event \FootprintListener ;
10- use RuntimeException ;
1111
12+ /**
13+ * @property \Cake\Http\ServerRequest $request
14+ */
1215trait FootprintAwareTrait
1316{
1417 /**
@@ -107,10 +110,11 @@ protected function _setCurrentUser($user = null): ?EntityInterface
107110 }
108111 } elseif ($ this ->components ()->has ('Auth ' )) {
109112 $ user = $ this ->Auth ->user ();
110- } elseif ($ this ->name !== 'Error ' ) {
111- throw new RuntimeException (
112- 'You must have AuthenticationComponent or AuthComponent loaded to use Footprint '
113- );
113+ } else {
114+ $ identity = $ this ->request ->getAttribute ('identity ' );
115+ if ($ identity && $ identity instanceof IdentityInterface) {
116+ $ user = $ identity ->getOriginalData ();
117+ }
114118 }
115119 }
116120
You can’t perform that action at this time.
0 commit comments