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
Ejemplo 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);
     }
 }
Ejemplo n.º 2
0
 public function delete()
 {
     $success = false;
     if (Auth::clear('default')) {
         $success = true;
     }
     //return compact('success');
     return $this->redirect('Posts');
 }
Ejemplo n.º 3
0
 public function testAuthLogout()
 {
     $user = array('user' => 'bob');
     $result = Auth::check('test', $user, array('success' => true));
     $this->assertEqual($user, $result);
     $result = Auth::check('test');
     $this->assertEqual($user, $result);
     Auth::clear('test');
     $this->assertFalse(Auth::check('test'));
 }
Ejemplo n.º 4
0
 /**
  * Clean every auth configuration.
  *
  * @param  string $name    Name of configuration, if specified
  * @param  array  $options Clear options
  */
 public static function clear($name = null, array $options = array())
 {
     if (!isset($name)) {
         foreach (static::$_configurations as $name => $config) {
             parent::clear($name, $options);
         }
     } else {
         parent::clear($name, $options);
     }
 }
Ejemplo n.º 5
0
 public function logout()
 {
     // Kill "remember me" info
     $current_identity = Auth::check('any');
     $current_identity->save(array('session' => null));
     setcookie('session.id', '', 0, '/', $_SERVER['HTTP_HOST']);
     // Kill current session
     Auth::clear('any');
     // Go home
     return $this->redirect('/');
 }
Ejemplo n.º 6
0
	public function tearDown() {
		Auth::clear('user');
	}
 public function delete()
 {
     Auth::clear('member');
     return $this->redirect('/');
 }
Ejemplo n.º 8
0
 /**
  * Destroy session - log out user
  */
 public function destroy()
 {
     Auth::clear('default');
     return $this->redirect('li3_usermanager.Session::create');
 }
Ejemplo n.º 9
0
 /**
  * Logs a user out.
  */
 public function logout()
 {
     Auth::clear('li3b_user');
     FlashMessage::write('You\'ve successfully logged out.', 'default');
     $this->redirect('/');
 }
Ejemplo n.º 10
0
 public function delete()
 {
     Auth::clear('default');
     return $this->redirect('/');
 }
Ejemplo n.º 11
0
    public function logout() {
        Auth::clear('minerva_user');
		FlashMessage::set('You\'ve successfully logged out.');
        $this->redirect(array('action' => 'login'));
    }
Ejemplo n.º 12
0
 public function delete()
 {
     Auth::clear('member');
     Session::delete('default');
     return $this->redirect('/');
     exit;
 }
 public function logout()
 {
     Auth::clear('default');
     return $this->redirect('Authors::login');
 }
Ejemplo n.º 14
0
	public function setUp() {
		Auth::clear('user');

		$this->_request = new Request(array(
			'params' => array(
				'library' => 'test_library',
				'controller' => 'test_controllers',
				'action' => 'test_action'
			)
		));

		Auth::config(array(
			'user' => array(
				'adapter' => 'li3_access\tests\mocks\extensions\adapter\auth\MockAuthAdapter'
			)
		));

		Access::config(array(
			'no_roles' => array(
				'adapter' => 'AuthRbac'
			),
			'test_check' => array(
				'adapter' => 'AuthRbac',
				'roles' => array(
					array(
						'resources' => 'user',
						'match' => '*::*'
					),
					array(
						'resources' => 'user',
						'match' => 'Pages::index'
					)
				)
			),
			'test_closures' => array(
				'adapter' => 'AuthRbac',
				'roles' => array(
					array(
						'resources' => '*',
						'allow' => array(function($request, &$roleOptions) {
							$roleOptions['message'] = 'Test allow options set.';
							return $request->params['allow'];
						}),
						'match' => array(
							function($request) {
								return $request->params['match'];
							},
							'controller' => 'TestControllers',
							'action' => 'test_action'
						)
					)
				)
			),
			'test_option_override' => array(
				'adapter' => 'AuthRbac',
				'roles' => array(
					array(
						'allow' => false,
						'resources' => '*',
						'match' => '*::*'
					),
					array(
						'message' => 'Rule access denied message.',
						'redirect' => '/',
						'options' => array(
							'class' => 'notice'
						),
						'resources' => 'user',
						'match' => 'TestControllers::test_action'
					),
					array(
						'message' => 'Test no overwrite.',
						'redirect' => 'Test::no_overwrite',
						'match' => null
					)
				)
			)
		));
	}
 public function delete()
 {
     Auth::clear('openid');
     return $this->redirect('/');
 }