[Security] fixes some regressions
This commit is contained in:
parent
b043bfde0b
commit
3dfc09cd8d
@ -66,12 +66,8 @@ class SecurityExtension extends Extension
|
|||||||
$loader->load('collectors.xml');
|
$loader->load('collectors.xml');
|
||||||
|
|
||||||
// set some global scalars
|
// set some global scalars
|
||||||
if (isset($config['access_denied_url'])) {
|
$container->setParameter('security.access.denied_url', $config['access_denied_url']);
|
||||||
$container->setParameter('security.access.denied_url', $config['access_denied_url']);
|
$container->setParameter('security.authentication.session_strategy.strategy', $config['session_fixation_strategy']);
|
||||||
}
|
|
||||||
if (isset($config['session_fixation_protection'])) {
|
|
||||||
$container->setParameter('security.authentication.session_strategy.strategy', $config['session_fixation_protection']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->createFirewalls($config, $container);
|
$this->createFirewalls($config, $container);
|
||||||
$this->createAuthorization($config, $container);
|
$this->createAuthorization($config, $container);
|
||||||
|
@ -195,7 +195,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$subRequest = Request::create($this->options['failure_path']);
|
$subRequest = Request::create($this->options['failure_path']);
|
||||||
$subRequest->attributes->set(SecurityContext::AUTHENTICATION_ERROR, $failed->getMessage());
|
$subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed->getMessage());
|
||||||
|
|
||||||
return $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
|
return $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
|
||||||
} else {
|
} else {
|
||||||
@ -203,7 +203,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
|
|||||||
$this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path']));
|
$this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$request->getSession()->set(SecurityContext::AUTHENTICATION_ERROR, $failed->getMessage());
|
$request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed->getMessage());
|
||||||
|
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response->setRedirect(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302);
|
$response->setRedirect(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302);
|
||||||
@ -221,8 +221,8 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
|
|||||||
$this->securityContext->setToken($token);
|
$this->securityContext->setToken($token);
|
||||||
|
|
||||||
$session = $request->getSession();
|
$session = $request->getSession();
|
||||||
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
|
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
|
||||||
$session->remove(SecurityContext::LAST_USERNAME);
|
$session->remove(SecurityContextInterface::LAST_USERNAME);
|
||||||
|
|
||||||
if (null !== $this->eventDispatcher) {
|
if (null !== $this->eventDispatcher) {
|
||||||
$this->eventDispatcher->notify(new Event($this, 'security.interactive_login', array('request' => $request, 'token' => $token)));
|
$this->eventDispatcher->notify(new Event($this, 'security.interactive_login', array('request' => $request, 'token' => $token)));
|
||||||
|
@ -124,7 +124,7 @@ class ExceptionListener implements ListenerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$subRequest = Request::create($this->errorPage);
|
$subRequest = Request::create($this->errorPage);
|
||||||
$subRequest->attributes->set(SecurityContext::ACCESS_DENIED_ERROR, $exception->getMessage());
|
$subRequest->attributes->set(SecurityContextInterface::ACCESS_DENIED_ERROR, $exception->getMessage());
|
||||||
|
|
||||||
$response = $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
|
$response = $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
|
||||||
$response->setStatusCode(403);
|
$response->setStatusCode(403);
|
||||||
|
@ -57,7 +57,7 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL
|
|||||||
$username = trim($request->get($this->options['username_parameter']));
|
$username = trim($request->get($this->options['username_parameter']));
|
||||||
$password = $request->get($this->options['password_parameter']);
|
$password = $request->get($this->options['password_parameter']);
|
||||||
|
|
||||||
$request->getSession()->set(SecurityContext::LAST_USERNAME, $username);
|
$request->getSession()->set(SecurityContextInterface::LAST_USERNAME, $username);
|
||||||
|
|
||||||
return $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $password, $this->providerKey));
|
return $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $password, $this->providerKey));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user