-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-8140: Enabled authenticator manager-based security #368
IBX-8140: Enabled authenticator manager-based security #368
Conversation
0f2c44c
to
261b681
Compare
261b681
to
1eaa9f0
Compare
d79da4b
to
edce935
Compare
src/lib/MVC/Symfony/Security/Authentication/DefaultAuthenticationSuccessHandler.php
Show resolved
Hide resolved
src/lib/MVC/Symfony/Security/Authentication/EventSubscriber/AccessDeniedSubscriber.php
Outdated
Show resolved
Hide resolved
@Steveb-p resolved via ceceb3f. Since the original listener definition was overridden within There is a slight change we can stop decorating the original listener in the next iterations. However, til this point I didn't find a way to hook into our SA resolving mechanism in the context of authorization using custom authenticator. |
…directing to the login form
…en detecting permission issues
0b61623
to
b65af9a
Compare
b4ef1c3
to
8093540
Compare
src/lib/MVC/Symfony/Security/Authentication/DefaultAuthenticationSuccessHandler.php
Outdated
Show resolved
Hide resolved
After internal sync with @Steveb-p I needed to revert decorating |
src/lib/MVC/Symfony/Security/Authentication/EventSubscriber/AccessDeniedSubscriber.php
Outdated
Show resolved
Hide resolved
|
* IBX-8140: Enabled authenticator manager-based security * adjusted tests after removing obsolete services * added proper access denied listener grouping all access issues and redirecting to the login form * [TMP][Behat] Added @javascript to failed scenarios to see screenshots * fixed phpstan * renamed AccessDeniedListener to *Subscriber and made it more loose when detecting permission issues * [TMP] Added dependencies.json * [TMP] Dropped core self-reference from dependencies.json * regenerated phpstan baseline * cr remarks * adjusted unit tests * removed unused methods due to SecurityPass changes * reverted decorating `DefaultAuthenticationSuccessHandler` * cr remarks * dropped @javascript due to performance reasons * removed dependencies.json --------- Co-authored-by: Andrew Longosz <[email protected]>
Disclaimer:
This PR allows Ibexa DXP to keep most basic security-related features in-tact with the new mechanism enabled. Most of the features around authorization needs to be at least revisited and in some cases re-implemented. They might stop working after merging this PR and will be addressed per-case-basis.
Technical details:
Main changes needed to handle the new security approach which is relying on authenticators and lack of the anonymous user.
In the nutshell:
security.authentication.provider.dao
andsecurity.authentication.provider.anonymous
providers coming from Symfony which are already removed, so the code fromSecurityPass
is not executed after enablingenable_authenticator_manager
flag,HttpBasicFactory
which doesn't seem to be needed anymore,Ibexa\Core\MVC\Symfony\Security\EventListener\SecurityListener
which contains some blurry logic that can and imho should be replaced by the new ways of doing security. However, we need to evaluate necessity and possible replacement forIbexa\Core\MVC\Symfony\Event\InteractiveLoginEvent
,src/lib/MVC/Symfony/Security/Authentication/DefaultAuthenticationSuccessHandler.php
which extends the built-in Symfony handler. It proves to be useful especially due to logic needed for proper redirection coming from parentSymfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler::onAuthenticationSuccess
method. I supplied it with proper setting repository user and emittingDetermineTargetUrlEvent
which is needed e.g. for Dashboard redirection after successful authorization to the Back Office,src/lib/MVC/Symfony/Security/Authentication/EventSubscriber/AccessDeniedListener.php
according to https://symfony.com/doc/5.x/security/access_denied_handler.html#customizing-all-access-denied-responses. The is still an option to implement some more custom logic with usage of firewall options: entry_point and access_denied_handler for forbidden resources,PasswordAuthenticatedUserInterface
implementation to thesrc/lib/MVC/Symfony/Security/User
class to meet the Symfony requirement of enabling password hashers:it just boils down to adding a strict type to
public function getPassword(): ?string
which doesn't seem to have any impact whatsoever,src/lib/MVC/Symfony/SiteAccess/Router.php::matchByName
since itstoString
method produces some noise when accessing siteaccess name. I will leave it as-is for now until some more visibility on this topic is there,class_alias
occurrences,tests/lib/MVC/Symfony/Security/Authentication/RememberMeRepositoryAuthenticationProviderTest.php
to not rely on the deprecated methodgetUsername
. The whole "Remember Me" feature however, needs to be also rewritten to rely on the new authenticator mechanisms, since the old fashion is mostly deprecated already.Known issues:
admin/dashboard
directly without being logged-in produces an error (possibly, missing access check in theibexa/dashboard
package,https://haveibeenpwned.com/
leaks should be re-implemented,GuardRepositoryAuthenticationProvider
needs to be re-implemented,Needs revisiting:
HttpBasicFactory
,InteractiveLoginEvent
,AccessDeniedListener
behaves when permissions are unsufficient,user/login
permissions.Related PRs:
Description:
For QA:
Documentation: