Skip to content

Commit

Permalink
Fix registration of failure handler
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Feb 16, 2024
1 parent 2b94931 commit 90c9016
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -135,6 +135,18 @@ public function getFirewallNames(): \ArrayIterator
return $this->firewallNames;
}

protected function createAuthenticationFailureHandler(ContainerBuilder $container, string $id, array $config): string
{
$id = $this->getFailureHandlerId($id);
$options = array_intersect_key($config, $this->defaultFailureHandlerOptions);

$failureHandler = $container->setDefinition($id, new ChildDefinition('security.authentication.custom_failure_handler'));
$failureHandler->replaceArgument(0, new ChildDefinition('hwi_oauth.authentication.failure_handler'));
$failureHandler->replaceArgument(1, $options);

return $id;
}

/**
* {@inheritdoc}
*/
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/config/oauth.php
Expand Up @@ -62,5 +62,10 @@
]);

$services->set('hwi_oauth.authentication.failure_handler', AuthenticationFailureHandler::class)
->arg('$connect', '%hwi_oauth.connect%');
->args([
service('request_stack'),
service('router'),
service('twig'),
'%hwi_oauth.connect%'
]);
};

0 comments on commit 90c9016

Please sign in to comment.