public function contextAction()
    {
        $tokenStorage = $this->get('security.token_storage');

        $token = $tokenStorage->getToken();
        $user = $token->getUser();

        $output = '<pre>';
        $output .= 'Token class: '.get_class($token).PHP_EOL;
        $output .= 'User class:  '.(is_object($user) ? get_class($user) : $user).PHP_EOL;
        $output .= PHP_EOL;
        $output .= 'Token username: ';
        $output .= print_r($token->getUsername(), 1).PHP_EOL;
        $output .= 'Token attributes: ';
        $output .= print_r($token->getAttributes(), 1).PHP_EOL;
        $output .= 'Token credentials: ';
        $output .= print_r($token->getCredentials(), 1).PHP_EOL;
        $output .= 'Token roles: ';
        $output .= print_r($token->getRoles(), 1).PHP_EOL;

        return new Response($output);
    }