lithium\security\Auth::clear PHP Method

clear() public static method

Removes session information for the given configuration, and allows the configuration's adapter to perform any associated cleanup tasks.
public static clear ( string $name, array $options = [] ) : void
$name string The name of the `Auth` configuration to clear the login information for. Calls the `clear()` method of the given configuration's adapter, and removes the information in the session key used by this configuration.
$options array Additional options used when clearing the authenticated session. See each adapter's `clear()` method for all available options. Global options: - `'clearSession'` _boolean_: If `true` (the default), session data for the specified configuration is removed, otherwise it is retained.
return void
    public static function clear($name, array $options = array())
    {
        $defaults = array('clearSession' => true);
        $options += $defaults;
        return static::_filter(__FUNCTION__, compact('name', 'options'), function ($self, $params) {
            extract($params);
            $config = $self::invokeMethod('_config', array($name));
            $session = $config['session'];
            if ($options['clearSession']) {
                $session['class']::delete($session['key'], $session['options']);
            }
            $self::adapter($name)->clear($options);
        });
    }

Usage Example

Esempio n. 1
0
 /**
  * Clears all other adapters
  *
  * @param array $options Adapter-specific options. Not implemented in this adapter.
  * @return void
  */
 public function clear(array $options = array())
 {
     foreach (Auth::config() as $name => $auth) {
         if ($auth['adapter'] === $this->_config['adapter']) {
             continue;
         }
         Auth::clear($name);
     }
 }
All Usage Examples Of lithium\security\Auth::clear