# |
Jul 23rd 2021, 13:05 |
kevin.pfeifer |
works for me now :thinking_face: |
# |
Jul 23rd 2021, 13:04 |
paolo.bragagni |
mmm |
# |
Jul 23rd 2021, 13:04 |
kevin.pfeifer |
try to just return false to test it |
# |
Jul 23rd 2021, 13:04 |
kevin.pfeifer |
thats a problem inside your policy |
# |
Jul 23rd 2021, 13:00 |
paolo.bragagni |
*Pre-authorization check must return `Authorization\Policy\ResultInterface`, `bool` or `null`.* |
# |
Jul 23rd 2021, 12:56 |
kevin.pfeifer |
well i basically copied my values from the use statement but i forgot that you need to add the \ if youre not using the class via the use |
# |
Jul 23rd 2021, 12:54 |
paolo.bragagni |
before Authorization |
# |
Jul 23rd 2021, 12:52 |
kevin.pfeifer |
could be that i forgot the \ at the front of App ,:) |
# |
Jul 23rd 2021, 12:51 |
paolo.bragagni |
*Interface 'App\Middleware\UnauthorizedHandler\Authorization\Middleware\UnauthorizedHandler\HandlerInterface' not found* |
# |
Jul 23rd 2021, 12:49 |
kevin.pfeifer |
basically i forgot the extend of the already present RedirectHandler |
# |
Jul 23rd 2021, 12:49 |
kevin.pfeifer |
check again, should be more clear now |
# |
Jul 23rd 2021, 12:44 |
paolo.bragagni |
fighting with namespaces |
# |
Jul 23rd 2021, 12:39 |
kevin.pfeifer |
i mixed 2 things together, let me fix that |
# |
Jul 23rd 2021, 12:39 |
kevin.pfeifer |
ah sorry, i forgot something |
# |
Jul 23rd 2021, 12:37 |
paolo.bragagni |
wait |
# |
Jul 23rd 2021, 12:37 |
paolo.bragagni |
I'm stupid |
# |
Jul 23rd 2021, 12:37 |
paolo.bragagni |
:S |
# |
Jul 23rd 2021, 12:37 |
paolo.bragagni |
*Handler `Regtosc` does not exist.* |
# |
Jul 23rd 2021, 12:32 |
paolo.bragagni |
thank you Kevin. trying to reproduce |
# |
Jul 23rd 2021, 12:32 |
kevin.pfeifer |
you can check out https://github.com/LordSimal/authorization/blob/master/docs/en/middleware.rst#how-to-create-a-custom-unauthorizedhandler till we wait till my PR is being reviewed |
# |
Jul 23rd 2021, 12:31 |
kevin.pfeifer |
well since you will be implementing a custom handler you can do that logic in there too |
# |
Jul 23rd 2021, 12:11 |
paolo.bragagni |
also redirection to previuos page needs an handler? |
# |
Jul 23rd 2021, 12:10 |
paolo.bragagni |
hhihi thanks (I think that its a common request, so probably should be included someway in default code) |
# |
Jul 23rd 2021, 12:08 |
kevin.pfeifer |
I am just in the process of updating the doc since its a bit more “advanced” I would say |
# |
Jul 23rd 2021, 12:06 |
paolo.bragagni |
first of all I dont know how to create my own handler |
# |
Jul 23rd 2021, 12:05 |
paolo.bragagni |
not so easy |
# |
Jul 23rd 2021, 11:46 |
paolo.bragagni |
:) |
# |
Jul 23rd 2021, 11:46 |
paolo.bragagni |
arghhhh |
# |
Jul 23rd 2021, 10:54 |
kevin.pfeifer |
so basically the example uses the RedirectHandler (`Authorization.Redirect` in your array above) which is this class in the plugin https://github.com/cakephp/authorization/blob/master/src/Middleware/UnauthorizedHandler/RedirectHandler.php |
# |
Jul 23rd 2021, 10:53 |
kevin.pfeifer |
what you do in that handle() function is basically up to you |
# |
Jul 23rd 2021, 10:52 |
kevin.pfeifer |
and with that you can also (as the doc describes) create your own Handler https://github.com/cakephp/authorization/blob/15aa0e01746c797ed3ce5ce745a7a3f08ccc0c6e/docs/en/middleware.rst#handling-unauthorized-requests |
# |
Jul 23rd 2021, 10:51 |
kevin.pfeifer |
|
# |
Jul 23rd 2021, 10:50 |
kevin.pfeifer |
The Flash message topic is pretty re-occuring. let me search the slack for how to do that |
# |
Jul 23rd 2021, 10:37 |
paolo.bragagni |
and what about flash message that shows user that it hasnt the authorization? |
# |
Jul 23rd 2021, 10:37 |
paolo.bragagni |
something like 'url' => $this->referer() |
# |
Jul 23rd 2021, 10:36 |
paolo.bragagni |
'unauthorizedHandler' => [ 'className' => 'Authorization.Redirect', 'url' => '/users/login', 'queryParam' => 'redirectUrl', 'exceptions' => [ MissingIdentityException::class, OtherException::class, ], |
# |
Jul 23rd 2021, 10:36 |
paolo.bragagni |
Hi in unauthorizedHandler how to redirect to last page? |
# |
Jul 23rd 2021, 00:14 |
web-54 |
hello |
# |
Jul 22nd 2021, 17:47 |
zxcvxcvzxcv |
=# |
# |
Jul 22nd 2021, 15:00 |
tyler.adam.lazenby |
hahaha |
# |
Jul 22nd 2021, 15:00 |
tyler.adam.lazenby |
Thanks @dereuromark I will have to go back the white board and figure out my logic. again |