<?php
namespace CU\SASCommonBundle\Security\Authentication\Token;
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
/**
* Auth Token
*
* A token represents the user authentication data present in the request.
* Once a request is authenticated, the token retains the user's data, and
* delivers this data across the security context.
*
* @author "Cornell University, Student Services IT"
*/
class CUUserToken extends AbstractToken
{
protected $httpCuwaGroups;
/**
* @param Role[] $roles An array of roles
*/
public function __construct(array $roles = array())
{
parent::__construct($roles);
// consider user authenticated if we have roles.
$isAuthenticated = count($roles) > 0;
$this->setAuthenticated($isAuthenticated);
$this->httpCuwaGroups = [];
}
/**
* Returns the user credentials.
*
* @return mixed The user credentials
*/
public function getCredentials()
{
return '';
}
/**
* Token stores cuwa groups only until after user provider has completed refresh of user obj.
*
* SHOULD NOT BE USED BY NON SASCommonBundle CODE
*
* @return array
*/
public function getHttpCuwaGroups()
{
return $this->httpCuwaGroups;
}
/**
* Temporary storage of directory groups.
*
* SHOULD NOT BE USED BY NON SASCommonBundle CODE
*
* @param array $httpCuwaGroups
* @return \CU\SASCommonBundle\Security\Authentication\Token\CUUserToken
*/
public function setHttpCuwaGroups($httpCuwaGroups)
{
$this->httpCuwaGroups = $httpCuwaGroups;
return $this;
}
}