diff --git a/src/Bundle/ChillMainBundle/Security/ChillSecurity.php b/src/Bundle/ChillMainBundle/Security/ChillSecurity.php new file mode 100644 index 000000000..eb21d00df --- /dev/null +++ b/src/Bundle/ChillMainBundle/Security/ChillSecurity.php @@ -0,0 +1,54 @@ +security->getUser(); + } + + public function getUser(): User + { + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new \LogicException(sprintf('authenticated user should be an instance of %s, %s given', User::class, null !== $user ? $user::class : self::class)); + } + + return $user; + } + + public function isGranted($attribute, $subject = null): bool + { + return $this->security->isGranted($attribute, $subject); + } + + public function getToken(): ?TokenInterface + { + return $this->security->getToken(); + } +}