public function __construct(User $user) { if (!$user->authenticate()) { throw new UsernameNotFoundException('Invalid Contao user given.'); } $this->setUser($user); $this->setAuthenticated(true); parent::__construct($this->getRolesFromUser($user)); }