feat(api): expose ProviderRegistry and ConditionRegistry with an interface#313
feat(api): expose ProviderRegistry and ConditionRegistry with an interface#313dt-thomas-durand wants to merge 1 commit intoscheb:8.xfrom
Conversation
…rface Motivation: allow override, and decoration of those pillars of the decision for when a 2fa triggers, and which one triggers.
|
Thanks a lot for the suggestion and for taking the time to draft up a solution. I'm personally not fully convinced by the idea, mainly because both of these classes are really just internal "infrastructure" that the bundle uses to do its work. They weren't designed as extension points where custom code is supposed to be injected. From the bundle's perspective, its functionality shouldn't depend on whether these classes exist in exactly this form or not. If I decide to refactor, I'd like to be able to do so freely within the internal implementation of the bundle. Regarding the "final" aspect of those classes: the intention here is to make it clear that these classes are not part of the public API. Instead of using an actual That said, I'd really like to better understand your use case and what you’re trying to achieve. Maybe we can find a more generic approach that fits better with the bundle’s design, rather than expanding its public surface area in a way that makes maintenance harder on the long-term. |
Description
This Pull Request adds
TwoFactorProviderRegistryInterfaceandTwoFactorConditionRegistryInterface, and expose the underlying classes to the rest of the code using those interface.The purpose is to allow a rewrite ; or a decoration of the logic underneath, unlocking more customization possibilities.
One example: in my codebase, I need to know when 2fa is enabled on a User, but skipped because of a condition.
This is easy when decorating
TwoFactorConditionRegistry; but because of the lack of interface, I must extends a@finalclass. It's possible, but not recommended.