phpCAS::checkAuthentication PHP Method

checkAuthentication() public static method

This method is called to check if the user is already authenticated locally or has a global cas session. A already existing cas session is determined by a cas gateway call.(cas login call without any interactive prompt)
public static checkAuthentication ( ) : true
return true when the user is authenticated, false when a previous gateway login failed or the function will not return if the user is redirected to the cas server for a gateway login attempt
    public static function checkAuthentication()
    {
        phpCAS::traceBegin();
        phpCAS::_validateClientExists();
        $auth = self::$_PHPCAS_CLIENT->checkAuthentication();
        // store where the authentication has been checked and the result
        self::$_PHPCAS_CLIENT->markAuthenticationCall($auth);
        phpCAS::traceEnd($auth);
        return $auth;
    }

Usage Example

 /**
  * Logs the user out / destroys the CAS session
  */
 public function index()
 {
     if (\phpCAS::checkAuthentication()) {
         \phpCAS::logout();
     }
     session_destroy();
     header("Location: /landing");
     return;
 }
All Usage Examples Of phpCAS::checkAuthentication