[Security] Add a Not_Full_Fledged_handler in ExceptionListener from security login#57661
[Security] Add a Not_Full_Fledged_handler in ExceptionListener from security login#57661eltharin wants to merge 8 commits intosymfony:8.1from
Conversation
64b0bdd to
7e36014
Compare
7e36014 to
a7ace88
Compare
bdb9552 to
f64b805
Compare
src/Symfony/Component/Security/Http/Authorization/SameAsNotFullFledgedHandle.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php
Outdated
Show resolved
Hide resolved
a5ff172 to
05ca8dd
Compare
There was a problem hiding this comment.
I'm not convinced by this PR. To me, it does not actually solve the issue it claims to solve (it solves only a subset of cases, bringing an invalid behavior for the other cases).
So for now, it gets a -1 vote from me.
src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Authorization/NotFullFledgedHandlerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Authorization/NotFullFledgedHandlerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Authorization/SameAsNotFullFledgedHandler.php
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| foreach($accessDeniedException->getAttributes() as $attribute) { | ||
| if(in_array($attribute, [AuthenticatedVoter::IS_AUTHENTICATED_FULLY])) { |
There was a problem hiding this comment.
This is not enough to identify all cases where an access denied exception might depend on the trust level of a token (see my comment on the issue).
There was a problem hiding this comment.
it totally a case whitch can be set in a custom handler.
SameAsNotFullFledgedHandler is here to anwser to many person, when PR will be merged (yes I beleive on it) if many persons have the same idea it can be possible to propose another PR for add core handlers
src/Symfony/Component/Security/Http/Authorization/NotFullFledgedHandlerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php
Show resolved
Hide resolved
|
I don't undestand why you say it does not actually solve the issue. the problem is to obtain a control of AccessDenied Exception when RememberMe login is active, this PR allow a custom handler to choose:
I don't see whitch case is not cover ? |
|
@eltharin have you read my comment on the issue ? |
|
I do but I don't understand where you find a problem, |
src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
Outdated
Show resolved
Hide resolved
60cb97e to
2c019ce
Compare
818ff65 to
91dc0c2
Compare
src/Symfony/Component/Security/Http/Authorization/NotFullFledgedHandlerInterface.php
Outdated
Show resolved
Hide resolved
0815414 to
3e1d1ea
Compare
3e1d1ea to
a96aecb
Compare
|
What can we do to advance this PR ? |
if not authenticated at all use callback instead boolean
add r to handleR
…Extension.php Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
a96aecb to
0fb0b24
Compare
My proposal for behaviour for acces Denied When User is logged with a remeberme token
Without set anything, the behaviour is the same as actually.
In the Firewall config adding a not_full_fledged_handler waiting a service handler or a predefined value :
"original""redirect" for the same behavior than actual replaced bySymfony\Component\Security\Http\Authorization\NotFullFledgedRedirectToStartAuthenticationHandler"same""equal" for if a user is logged but not not full fledged (and the attribute is not IS_AUTHENTICATED_FULLY) he has the same acces than if he was full logged. this value is replaced bySymfony\Component\Security\Http\Authorization\NotFullFledgedEqualNormalLoginHandlerSymfony\Component\Security\Http\Authorization\NotFullFledgedHandlerInterfacewith one method "handle"this method can return a reponse to change original Exception Response or null for continue to throw the original access denied exception.