src/Security/Security.php
public function logout($request = null, $service = Authenticator::LOGOUT)
    {
        $authName = null;

        if (!$request) {
            $request = $this->getRequest();
        }

        $handlers = $this->getServiceAuthenticatorsFromRequest($service, $request);

        $link = $this->Link('logout');
        array_walk(
            $handlers,
            function (Authenticator &$auth, $name) use ($link) {
                $auth = $auth->getLogoutHandler(Controller::join_links($link, $name));
            }
        );

        return $this->delegateToMultipleHandlers(
            $handlers,
            _t(__CLASS__ . '.LOGOUT', 'Log out'),
            $this->getTemplatesFor('logout'),
            [$this, 'aggregateAuthenticatorResponses']
        );
    }
public function logout($request = null, $service = Authenticator::LOGOUT)
    {
        $authName = null;

        if (!$request) {
            $request = $this->getRequest();
        }

        $handlers = $this->getServiceAuthenticatorsFromRequest($service, $request);

        $link = $this->Link('logout');
        array_walk(
            $handlers,
            function (Authenticator &$auth, $name) use ($link) {
                $auth = $auth->getLogoutHandler(Controller::join_links($link, $name));
            }
        );

        return $this->delegateToMultipleHandlers(
            $handlers,
            _t(__CLASS__ . '.LOGOUT', 'Log out'),
            $this->getTemplatesFor('logout'),
            [$this, 'aggregateAuthenticatorResponses']
        );
    }
public function logout ( $ request = null , $ service = Authenticator :: LOGOUT ) { $ authName = null ; if ( ! $ request ) { $ request = $ this -> getRequest ( ) ; } $ handlers = $ this -> getServiceAuthenticatorsFromRequest ( $ service , $ request ) ; $ link = $ this -> Link ( 'logout' ) ; array_walk ( $ handlers , function ( Authenticator & $ auth , $ name ) use ( $ link ) { $ auth = $ auth -> getLogoutHandler ( Controller :: join_links ( $ link , $ name ) ) ; } ) ; return $ this -> delegateToMultipleHandlers ( $ handlers , _t ( __CLASS__ . '.LOGOUT' , 'Log out' ) , $ this -> getTemplatesFor ( 'logout' ) , [ $ this , 'aggregateAuthenticatorResponses' ] ) ; }
Log the currently logged in user out

Logging out without ID-parameter in the URL, will log the user out of all applicable Authenticators.

Adding an ID will only log the user out of that Authentication method.

@param null|HTTPRequest $request
@param int $service
@return HTTPResponse|string
Log the currently logged in user out