public function checkAuthentication()
    {
        phpCAS::traceBegin();
        $res = false;
        if ( $this->isAuthenticated() ) {
            phpCAS::trace('user is authenticated');
            /* The 'auth_checked' variable is removed just in case it's set. */
            unset($_SESSION['phpCAS']['auth_checked']);
            $res = true;
        } else if (isset($_SESSION['phpCAS']['auth_checked'])) {
            // the previous request has redirected the client to the CAS server
            // with gateway=true
            unset($_SESSION['phpCAS']['auth_checked']);
            $res = false;
        } else {
            // avoid a check against CAS on every request
            if (!isset($_SESSION['phpCAS']['unauth_count'])) {
                $_SESSION['phpCAS']['unauth_count'] = -2; // uninitialized
            }

            if (($_SESSION['phpCAS']['unauth_count'] != -2
                && $this->_cache_times_for_auth_recheck == -1)
                || ($_SESSION['phpCAS']['unauth_count'] >= 0
                && $_SESSION['phpCAS']['unauth_count'] < $this->_cache_times_for_auth_recheck)
            ) {
                $res = false;

                if ($this->_cache_times_for_auth_recheck != -1) {
                    $_SESSION['phpCAS']['unauth_count']++;
                    phpCAS::trace(
                        'user is not authenticated (cached for '
                        .$_SESSION['phpCAS']['unauth_count'].' times of '
                        .$this->_cache_times_for_auth_recheck.')'
                    );
                } else {
                    phpCAS::trace(
                        'user is not authenticated (cached for until login pressed)'
                    );
                }
            } else {
                $_SESSION['phpCAS']['unauth_count'] = 0;
                $_SESSION['phpCAS']['auth_checked'] = true;
                phpCAS::trace('user is not authenticated (cache reset)');
                $this->redirectToCas(true/* gateway */);
                // never reached
                $res = false;
            }
        }
        phpCAS::traceEnd($res);
        return $res;
    }
public function checkAuthentication()
    {
        phpCAS::traceBegin();
        $res = false;
        if ( $this->isAuthenticated() ) {
            phpCAS::trace('user is authenticated');
            /* The 'auth_checked' variable is removed just in case it's set. */
            unset($_SESSION['phpCAS']['auth_checked']);
            $res = true;
        } else if (isset($_SESSION['phpCAS']['auth_checked'])) {
            // the previous request has redirected the client to the CAS server
            // with gateway=true
            unset($_SESSION['phpCAS']['auth_checked']);
            $res = false;
        } else {
            // avoid a check against CAS on every request
            if (!isset($_SESSION['phpCAS']['unauth_count'])) {
                $_SESSION['phpCAS']['unauth_count'] = -2; // uninitialized
            }

            if (($_SESSION['phpCAS']['unauth_count'] != -2
                && $this->_cache_times_for_auth_recheck == -1)
                || ($_SESSION['phpCAS']['unauth_count'] >= 0
                && $_SESSION['phpCAS']['unauth_count'] < $this->_cache_times_for_auth_recheck)
            ) {
                $res = false;

                if ($this->_cache_times_for_auth_recheck != -1) {
                    $_SESSION['phpCAS']['unauth_count']++;
                    phpCAS::trace(
                        'user is not authenticated (cached for '
                        .$_SESSION['phpCAS']['unauth_count'].' times of '
                        .$this->_cache_times_for_auth_recheck.')'
                    );
                } else {
                    phpCAS::trace(
                        'user is not authenticated (cached for until login pressed)'
                    );
                }
            } else {
                $_SESSION['phpCAS']['unauth_count'] = 0;
                $_SESSION['phpCAS']['auth_checked'] = true;
                phpCAS::trace('user is not authenticated (cache reset)');
                $this->redirectToCas(true/* gateway */);
                // never reached
                $res = false;
            }
        }
        phpCAS::traceEnd($res);
        return $res;
    }
public function checkAuthentication ( ) { phpCAS :: traceBegin ( ) ; $ res = false ; if ( $ this -> isAuthenticated ( ) ) { phpCAS :: trace ( 'user is authenticated' ) ; /* The 'auth_checked' variable is removed just in case it's set. */ unset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ; $ res = true ; } else if ( isset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ) { // the previous request has redirected the client to the CAS server // with gateway=true unset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ; $ res = false ; } else { // avoid a check against CAS on every request if ( ! isset ( $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] ) ) { $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] = - 2 ; // uninitialized } if ( ( $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] != - 2 && $ this -> _cache_times_for_auth_recheck == - 1 ) || ( $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] >= 0 && $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] < $ this -> _cache_times_for_auth_recheck ) ) { $ res = false ; if ( $ this -> _cache_times_for_auth_recheck != - 1 ) { $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] ++ ; phpCAS :: trace ( 'user is not authenticated (cached for ' . $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] . ' times of ' . $ this -> _cache_times_for_auth_recheck . ')' ) ; } else { phpCAS :: trace ( 'user is not authenticated (cached for until login pressed)' ) ; } } else { $ _SESSION [ 'phpCAS' ] [ 'unauth_count' ] = 0 ; $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] = true ; phpCAS :: trace ( 'user is not authenticated (cache reset)' ) ; $ this -> redirectToCas ( true /* gateway */ ) ; // never reached $ res = false ; } } phpCAS :: traceEnd ( $ res ) ; return $ res ; }
This method is called to check whether the user is authenticated or not.

@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
This method is called to check whether the user is authenticated or not .