/**
  * @param \AerialShip\SamlSPBundle\Bridge\SamlSpInfo $samlInfo
  * @param array $attributes
  * @param array $roles
  * @param mixed $user
  * @return SamlSpToken
  */
 protected function createAuthenticatedToken(SamlSpInfo $samlInfo, array $attributes, array $roles, $user)
 {
     if ($user instanceof UserInterface && $this->userChecker) {
         $this->userChecker->checkPostAuth($user);
     }
     $newToken = new SamlSpToken($this->providerKey, $roles);
     $newToken->setUser($user);
     $newToken->setAttributes($attributes);
     $newToken->setSamlSpInfo($samlInfo);
     $newToken->setAuthenticated(true);
     if (!in_array('ROLE_USER', $roles)) {
         $roles[] = 'ROLE_USER';
     }
     return $newToken;
 }