/**
* Initializes the security context for the given request.
*
* @return void
* @throws Exception
*/
public function initialize()
{
if ($this->initialized === true) {
return;
}
if ($this->canBeInitialized() === false) {
throw new Exception('The security Context cannot be initialized yet. Please check if it can be initialized with $securityContext->canBeInitialized() before trying to do so.', 1358513802);
}
if ($this->csrfProtectionStrategy !== self::CSRF_ONE_PER_SESSION) {
$this->csrfProtectionTokens = [];
}
$this->tokens = $this->mergeTokens($this->authenticationManager->getTokens(), $this->tokens);
$this->separateActiveAndInactiveTokens();
$this->updateTokens($this->activeTokens);
$this->initialized = true;
}