Provides an authentication check on methods and classes marked with @secured annotation

@return array|NULL
511562
protected function findFlag()
	{
		$annotation = 'secured';

		$signal = $this->signal;
		$signal = is_array($signal) ? reset($signal) : $signal;

		$actionMethod = $this->formatActionMethod($this->action);
		$signalMethod = $this->formatSignalMethod($signal);
		$renderMethod = $this->formatRenderMethod($this->view);

		if ($this->hasAnnotation($annotation))
		{
			return $this->getAnnotation($this->getReflection(), $annotation);
		}
		elseif ($this->hasMethodAnnotation($actionMethod, $annotation))
		{
			$reflection = Method::from($this, $actionMethod);
			return $this->getAnnotation($reflection, $annotation);
		}
		elseif ($this->isSignalReceiver($this) && $this->hasMethodAnnotation($signalMethod, $annotation))
		{
			$reflection = Method::from($this, $signalMethod);
			return $this->getAnnotation($reflection, $annotation);
		}
		elseif ($this->hasMethodAnnotation($renderMethod, $annotation))
		{
			$reflection = Method::from($this, $renderMethod);
			return $this->getAnnotation($reflection, $annotation);
		}

		return NULL;
	}
127864
public static function password_validator()
    {
        if (Injector::inst()->has(PasswordValidator::class)) {
            return Injector::inst()->get(PasswordValidator::class);
        }
        return null;
    }
1205497
protected function getVerifyCredentialsCallback()
    {
        if (is_null($this->callback) || !is_callable($this->callback)) {
            throw new Exception\ServerErrorException('Null or non-callable callback set on Password grant');
        }

        return $this->callback;
    }
73910
protected function getTokenCredentials() {
        return [
            'server' => $this->settings->getServiceEndpoint( 'sts' ),
            'endpoint' => $this->settings->getAuthenticationEndpoint(),
            'username' => $this->settings->username,
            'password' => $this->settings->password,
        ];
    }
404223
public function getProtectedMethod(...$params)
    {
        if (is_string($params[0])) {
            list($className, $object, $name) = $params;
        } elseif (is_object($params[0])) {
            list($object, $name) = $params;
            $className = get_class($object);
        }

        /** @var string $className */
        /** @var object $object */
        /** @var string $name */


        $this->checkOnObject($object);
        $this->checkOnMemberName($name);

        $reflector = $this->getReflectionMethod($className, $name);

        return $reflector->getClosure($object);
    }
1232794
protected function getFormList()
    {
        $formList = [];
        foreach ($this->availableAuthenticators as $key => $className) {
            /** @var BootstrapMFAAuthenticator $class */
            $class = Injector::inst()->get($className);
            $formList[] = $class->getMFAForm($this, static::VERIFICATION_METHOD);
        }

        return $formList;
    }
97819
protected function getCredentials()
    {
        if (empty($this->username) || empty($this->password)) {
            throw new \Exception('Basic authentication requires a $username & $password property.');
        }

        return [$this->username, $this->password];
    }
793009
public function identify(array $credentials)
    {
        /** @var \Authentication\Identifier\IdentifierInterface $identifier */
        foreach ($this->_loaded as $name => $identifier) {
            $result = $identifier->identify($credentials);
            if ($result) {
                return $result;
            }
            $this->_errors[$name] = $identifier->getErrors();
        }

        return null;
    }
305557
public function isAuthenticated()
    {
        if ($this->isAuthenticated === null) {
            try {
                $this->authenticate();
            } catch (AuthenticationRequiredException $exception) {
            }
        }
        return $this->isAuthenticated;
    }
173713
protected function getAuthForLogin()
	{
		// If a "key" was specified in the auth credentials, we will load it into a
		// secure RSA key instance, which will be used to connect to the servers
		// in place of a password, and avoids the developer specifying a pass.
		if ($this->hasRsaKey())
		{
			return $this->loadRsaKey($this->auth);
		}

		// If a plain password was set on the auth credentials, we will just return
		// that as it can be used to connect to the server. This will be used if
		// there is no RSA key and it gets specified in the credential arrays.
		elseif (isset($this->auth['password']))
		{
			return $this->auth['password'];
		}

		throw new \InvalidArgumentException('Password / key is required.');
	}
184791
public function getLoginForms()
    {
        Deprecation::notice('5.0.0', 'Now handled by delegateToMultipleHandlers');

        return array_map(
            function (Authenticator $authenticator) {
                return [
                    $authenticator->getLoginHandler($this->Link())->loginForm()
                ];
            },
            $this->getApplicableAuthenticators()
        );
    }
696524
public static function authenticate()
    {
        //if there is no username or password, fail
        if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
            return null;
        }

        // With a valid user and password, check the password is correct
        $data = [
            'Email' => $_SERVER['PHP_AUTH_USER'],
            'Password' => $_SERVER['PHP_AUTH_PW'],
        ];
        $request = Controller::curr()->getRequest();
        $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::LOGIN);
        $member = null;
        foreach ($authenticators as $authenticator) {
            $member = $authenticator->authenticate($data, $request);
            if ($member) {
                break;
            }
        }
        return $member;
    }
348290
protected function getAuthForLogin()
    {
        if ($this->useAgent()) {
            return $this->getAgent();
        }

        // If a "key" was specified in the auth credentials, we will load it into a
        // secure RSA key instance, which will be used to connect to the servers
        // in place of a password, and avoids the developer specifying a pass.
        elseif ($this->hasRsaKey()) {
            return $this->loadRsaKey($this->auth);
        }

        // If a plain password was set on the auth credentials, we will just return
        // that as it can be used to connect to the server. This will be used if
        // there is no RSA key and it gets specified in the credential arrays.
        elseif (isset($this->auth['password'])) {
            return $this->auth['password'];
        }

        throw new \InvalidArgumentException('Password / key is required.');
    }
658552
private function getMethodSignature($method)
    {
        $validMethod = isset($this->methods[$method])
            && is_array($this->methods[$method])
            && count($this->methods[$method]) >= 2;

        if ($validMethod) {
            return $this->methods[$method];
        }

        return null;
    }
1312778
private function authenticateBySession()
    {
        $u = $this->userFactory()->create($this->userType());
        // Call static method on user
        $u = call_user_func([get_class($u), 'getAuthenticated'], $this->userFactory());

        if ($u && $u->id()) {
            $u->saveToSession();

            return $u;
        } else {
            return null;
        }
    }
589502
public function check()
    {
        $attributes = $this->getInputAttributes();
        if (array_key_exists('name', $attributes)) {
            $inputName = $attributes['name'];
        } else {
            $inputName = static::DEFAULT_INPUT_NAME;
        }
        $checkCode = $this->request->get($inputName);
        if (!is_string($checkCode)) {
            $checkCode = '';
        }

        return $this->securimage->check($checkCode);
    }
644777
function acs()
    {

        /** @var $auth OneLogin_Saml2_Auth */
        $auth = $this->auth;

        $auth->processResponse();

        $errors = $auth->getErrors();

        if (!empty($errors)) {
            return $errors;
        }

        if (!$auth->isAuthenticated()) {
            return array('error' => 'Could not authenticate');
        }

        return null;

    }