phpCAS::logout PHP Méthode

logout() public static méthode

This method is used to logout from CAS.
public static logout ( string $params = "" ) : void
$params string an array that contains the optional url and service parameters that will be passed to the CAS server
Résultat void
    public static function logout($params = "")
    {
        phpCAS::traceBegin();
        phpCAS::_validateClientExists();
        $parsedParams = array();
        if ($params != "") {
            if (is_string($params)) {
                phpCAS::error('method `phpCAS::logout($url)\' is now deprecated, use `phpCAS::logoutWithUrl($url)\' instead');
            }
            if (!is_array($params)) {
                phpCAS::error('type mismatched for parameter $params (should be `array\')');
            }
            foreach ($params as $key => $value) {
                if ($key != "service" && $key != "url") {
                    phpCAS::error('only `url\' and `service\' parameters are allowed for method `phpCAS::logout($params)\'');
                }
                $parsedParams[$key] = $value;
            }
        }
        self::$_PHPCAS_CLIENT->logout($parsedParams);
        // never reached
        phpCAS::traceEnd();
    }

Usage Example

Exemple #1
0
    /**
     * Handle plugin-specific actions
     * These actions are handled at the startup hook rather than registered as
     * custom actions because the user session does not necessarily exist when
     * these actions need to be handled.
     *
     * @param array $args arguments from rcmail
     * @return array modified arguments
     */
    function startup($args) {
        // intercept PGT callback action
        if ($args['action'] == 'pgtcallback') {
            // initialize CAS client
            $this->cas_init();
            
            // retrieve and store PGT if present
            phpCAS::forceAuthentication();
            
            // end script
            exit;
        }
        
        // intercept CAS logout action
        else if ($args['action'] == 'caslogout') {
            // initialize CAS client
            $this->cas_init();

            // logout from CAS server
            phpCAS::logout();

            // end script
            exit;
        }
		  $args['valid'] = true; 
        return $args;
    }
All Usage Examples Of phpCAS::logout