Constructor.
public __construct ( string $secret, string | object $user, array $roles = [] ) | ||
$secret | string | A secret used to make sure the token is created by the app and not by a malicious client |
$user | string | object | The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string |
$roles | array | An array of roles |
/** * Constructor. * * @codeCoverageIgnore * * @param string $key The key shared with the authentication provider * @param string $user The user * @param RoleInterface[] $roles An array of roles */ public function __construct($key, $user, array $roles = array()) { parent::__construct($key, $user, $roles); $this->setAuthenticated(true); }
/** * Constructor. */ public function __construct() { parent::__construct(session_id(), 'anonymous'); }