public function checkAuthAction(Request $request)
    {
        $user = $this->getUser();

        if (null !== $user) {
            if (!$user instanceof UserInformationInterface) {
                throw new \RuntimeException('Invalid user object');
            }

            $lifetime = $this->determineLifeTime($request);

            $token = $this->get('tenside.jwt_authenticator')->getTokenForData($user, $lifetime);
            return new JsonResponse(
                [
                    'status'    => 'OK',
                    'token'     => $token,
                    'acl'       => $user->getRoles(),
                    'username'  => $user->getUsername(),
                    'ttl'       => (null === $lifetime) ? 'unlimited' : date('r', (time() + $lifetime))
                ],
                JsonResponse::HTTP_OK,
                ['Authentication' => $token]
            );
        }

        return new JsonResponse(['status' => 'unauthorized'], JsonResponse::HTTP_UNAUTHORIZED);
    }