8000 [Security] [Firewall] Fix support of multiple HTTP authentication methods by raziel057 · Pull Request #24166 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] [Firewall] Fix support of multiple HTTP authentication methods #24166

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

Closed
wants to merge 2 commits into from

Conversation

raziel057
Copy link
Contributor
Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #10035

Configuring guard along with http_digest breaks, because the default entry point for the firewall is automatically the guard authenticator, which is not a BasicAuthenticationEntryPoint / DigestAuthenticationEntryPoint.
We do create the entry point if there is no default entry point configured, so we should keep creating it if the default one is not an instance of BasicAuthenticationEntryPoint / DigestAuthenticationEntryPoint.
Related to lexik/LexikJWTAuthenticationBundle#384.

@raziel057 raziel057 changed the title Fix entry point [Security] [Firewall] Fix support of multiple HTTP authentication methods Sep 12, 2017
@chalasr
Copy link
Member
chalasr commented Sep 12, 2017

This fixes a bug, it should target 2.7.

@@ -66,7 +67,7 @@ public function addConfiguration(NodeDefinition $node)

protected function createEntryPoint($container, $id, $config, $defaultEntryPoint)
{
if (null !== $defaultEntryPoint) {
if (null !== $defaultEntryPoint && $defaultEntryPoint instanceof BasicAuthenticationEntryPoint) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is broken, $defaultEntryPoint is a service id here (string), and we cannot dofindDefinition($defaultEntryPointId)->getClass() since the definition won't exist at this stage.
I fear we need a compiler pass to fix this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry indeed this is weird. It just works because we never enter in the next statement. The entry point is created even if there is a default matching entry point.

@@ -15,6 +15,7 @@
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to update this one, BasicAuthenticationListener supports any AuthenticationEntryPointInterface. Only digest is tied to a specific implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to replace my digest authentication by basic and I had the same issue. That's why I also modified this class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, I'll try it. Thanks

@raziel057 raziel057 closed this Sep 12, 2017
@chalasr
Copy link
Member
chalasr commented Sep 12, 2017

@raziel057 I can take care of this if you are ok, I'll give you a workaround in the lexikjwt issue meanwhile.

@raziel057
Copy link
Contributor Author

@chalasr no problem. I let you work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0