Release 2.36.0 (#5514)
This commit is contained in:
@@ -12,6 +12,7 @@ namespace App\Saml;
|
||||
use App\Configuration\SamlConfigurationInterface;
|
||||
use App\Saml\Security\SamlAuthenticationFailureHandler;
|
||||
use App\Saml\Security\SamlAuthenticationSuccessHandler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
@@ -40,7 +41,8 @@ class SamlAuthenticator extends AbstractAuthenticator
|
||||
private readonly SamlAuthenticationFailureHandler $failureHandler,
|
||||
private readonly SamlAuthFactory $samlAuthFactory,
|
||||
private readonly SamlProvider $samlProvider,
|
||||
private readonly SamlConfigurationInterface $configuration
|
||||
private readonly SamlConfigurationInterface $configuration,
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -86,6 +88,7 @@ class SamlAuthenticator extends AbstractAuthenticator
|
||||
// file_put_contents(__DIR__ . '/../../var/log/saml.xml', $oneLoginAuth->getLastResponseXML());
|
||||
|
||||
if (\count($oneLoginAuth->getErrors()) > 0) {
|
||||
$this->logger->critical('SAML login failed: ' . $oneLoginAuth->getLastErrorReason());
|
||||
throw new AuthenticationException($oneLoginAuth->getLastErrorReason());
|
||||
}
|
||||
|
||||
@@ -102,7 +105,9 @@ class SamlAuthenticator extends AbstractAuthenticator
|
||||
|
||||
if (isset($this->options['username_attribute'])) {
|
||||
if (!\array_key_exists($this->options['username_attribute'], $attributes)) {
|
||||
throw new \Exception(\sprintf("Attribute '%s' not found in SAML data", $this->options['username_attribute']));
|
||||
$errorMessage = \sprintf("Attribute '%s' not found in SAML data", $this->options['username_attribute']);
|
||||
$this->logger->critical($errorMessage);
|
||||
throw new \Exception($errorMessage);
|
||||
}
|
||||
|
||||
$username = $attributes[$this->options['username_attribute']][0];
|
||||
|
||||
Reference in New Issue
Block a user