Horde_Registry::clearAuth PHP Method

clearAuth() public method

Clears any authentication tokens in the current session.
public clearAuth ( boolean $destroy = true )
$destroy boolean Destroy the session?
    public function clearAuth($destroy = true)
    {
        global $session;
        /* Do application logout tasks. */
        /* @todo: Replace with exclusively registered logout tasks. */
        foreach ($this->getAuthApps() as $app) {
            try {
                $this->callAppMethod($app, 'logout');
            } catch (Horde_Exception $e) {
            }
        }
        /* Do registered logout tasks. */
        $logout = new Horde_Registry_Logout();
        $logout->run();
        // @suspicious shouldn't this be 'auth/'
        $session->remove('horde', 'auth');
        $session->remove('horde', 'auth_app/');
        $this->_cache['auth'] = null;
        $this->_cache['existing'] = $this->_cache['isauth'] = array();
        if ($destroy) {
            $session->destroy();
        }
    }

Usage Example

Example #1
0
 /**
  * Clear the authentication and destroy the current session.
  */
 public function clearAuth()
 {
     $this->_registry->clearAuth(true);
 }