private function validateAuthentication()
{
- if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
+ if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
throw new AccessDeniedException();
}
}
*/
private function validateUserAccess($requestUserId)
{
- $user = $this->get('security.context')->getToken()->getUser();
+ $user = $this->get('security.token_storage')->getToken()->getUser();
if ($requestUserId != $user->getId()) {
throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId());
}
$client = static::createClient();
$container = $client->getContainer();
- $session = $container->get('session');
/** @var $userManager \FOS\UserBundle\Doctrine\UserManager */
$userManager = $container->get('fos_user.user_manager');
/** @var $loginManager \FOS\UserBundle\Security\LoginManager */
$loginManager->loginUser($firewallName, $user);
// save the login token into the session and put it in a cookie
- $container->get('session')->set('_security_'.$firewallName,
- serialize($container->get('security.context')->getToken()));
+ $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));
$container->get('session')->save();
+
+ $session = $container->get('session');
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
return $client;
namespace Wallabag\CoreBundle\Helper;
use Liip\ThemeBundle\Helper\DeviceDetectionInterface;
-use Symfony\Component\Security\Core\SecurityContextInterface;
+use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\UserBundle\Entity\User;
/**
*/
class DetectActiveTheme implements DeviceDetectionInterface
{
- protected $securityContext;
+ protected $tokenStorage;
protected $defaultTheme;
/**
- * @param SecurityContextInterface $securityContext Needed to retrieve the current user
+ * @param TokenStorageInterface $tokenStorage Needed to retrieve the current user
* @param string $defaultTheme Default theme when user isn't logged in
*/
- public function __construct(SecurityContextInterface $securityContext, $defaultTheme)
+ public function __construct(TokenStorageInterface $tokenStorage, $defaultTheme)
{
- $this->securityContext = $securityContext;
+ $this->tokenStorage = $tokenStorage;
$this->defaultTheme = $defaultTheme;
}
*/
public function getType()
{
- $token = $this->securityContext->getToken();
+ $token = $this->tokenStorage->getToken();
if (is_null($token)) {
return $this->defaultTheme;
wallabag_core.helper.detect_active_theme:
class: Wallabag\CoreBundle\Helper\DetectActiveTheme
arguments:
- - @security.context
+ - @security.token_storage
- %theme% # default theme from parameters.yml
# custom form type