src/Security/Security.php
protected function getServiceAuthenticatorsFromRequest($service, HTTPRequest $request)
    {
        $authName = null;

        if ($request->param('ID')) {
            $authName = $request->param('ID');
        }

        // Delegate to a single named handler - e.g. Security/login/<authname>/
        if ($authName && $this->hasAuthenticator($authName)) {
            if ($request) {
                $request->shift();
            }

            $authenticator = $this->getAuthenticator($authName);

            if (!$authenticator->supportedServices() & $service) {
                // Try to be helpful and show the service constant name, e.g. Authenticator::LOGIN
                $constants = array_flip((new ReflectionClass(Authenticator::class))->getConstants());

                $message = 'Invalid Authenticator "' . $authName . '" for ';
                if (array_key_exists($service, $constants)) {
                    $message .= 'service: Authenticator::' . $constants[$service];
                } else {
                    $message .= 'unknown authenticator service';
                }

                throw new HTTPResponse_Exception($message, 400);
            }

            $handlers = [$authName => $authenticator];
        } else {
            // Delegate to all of them, building a tabbed view - e.g. Security/login/
            $handlers = $this->getApplicableAuthenticators($service);
        }

        return $handlers;
    }
protected function getServiceAuthenticatorsFromRequest($service, HTTPRequest $request)
    {
        $authName = null;

        if ($request->param('ID')) {
            $authName = $request->param('ID');
        }

        // Delegate to a single named handler - e.g. Security/login/<authname>/
        if ($authName && $this->hasAuthenticator($authName)) {
            if ($request) {
                $request->shift();
            }

            $authenticator = $this->getAuthenticator($authName);

            if (!$authenticator->supportedServices() & $service) {
                // Try to be helpful and show the service constant name, e.g. Authenticator::LOGIN
                $constants = array_flip((new ReflectionClass(Authenticator::class))->getConstants());

                $message = 'Invalid Authenticator "' . $authName . '" for ';
                if (array_key_exists($service, $constants)) {
                    $message .= 'service: Authenticator::' . $constants[$service];
                } else {
                    $message .= 'unknown authenticator service';
                }

                throw new HTTPResponse_Exception($message, 400);
            }

            $handlers = [$authName => $authenticator];
        } else {
            // Delegate to all of them, building a tabbed view - e.g. Security/login/
            $handlers = $this->getApplicableAuthenticators($service);
        }

        return $handlers;
    }
protected function getServiceAuthenticatorsFromRequest ( $ service , HTTPRequest $ request ) { $ authName = null ; if ( $ request -> param ( 'ID' ) ) { $ authName = $ request -> param ( 'ID' ) ; } // Delegate to a single named handler - e.g. Security/login/<authname>/ if ( $ authName && $ this -> hasAuthenticator ( $ authName ) ) { if ( $ request ) { $ request -> shift ( ) ; } $ authenticator = $ this -> getAuthenticator ( $ authName ) ; if ( ! $ authenticator -> supportedServices ( ) & $ service ) { // Try to be helpful and show the service constant name, e.g. Authenticator::LOGIN $ constants = array_flip ( ( new ReflectionClass ( Authenticator :: class ) ) -> getConstants ( ) ) ; $ message = 'Invalid Authenticator "' . $ authName . '" for ' ; if ( array_key_exists ( $ service , $ constants ) ) { $ message .= 'service: Authenticator::' . $ constants [ $ service ] ; } else { $ message .= 'unknown authenticator service' ; } throw new HTTPResponse_Exception ( $ message , 400 ) ; } $ handlers = [ $ authName => $ authenticator ] ; } else { // Delegate to all of them, building a tabbed view - e.g. Security/login/ $ handlers = $ this -> getApplicableAuthenticators ( $ service ) ; } return $ handlers ; }
Get authenticators for the given service, optionally filtered by the ID parameter
of the current request

@param int $service
@param HTTPRequest $request
@return array|Authenticator[]
@throws HTTPResponse_Exception
Get authenticators for the given service optionally filtered by the ID parameter of the current request