This method attempts to validate that the record in the resultset is indeed a record that matched the identity
provided to this adapter.

@param array $resultIdentity

@return AuthenticationResult
517113
protected function authenticateValidateResult($resultIdentity)
    {
        /** @noinspection TypeUnsafeComparisonInspection */
        if ($resultIdentity['zend_auth_credential_match'] != '1') {
            $this->storeAuthenticationResult(
                AuthenticationResult::FAILURE_CREDENTIAL_INVALID,
                null,
                ['Supplied credential is invalid.']
            );
        } else {
            unset($resultIdentity['zend_auth_credential_match']);

            $this->resultRow = $resultIdentity;

            $this->storeAuthenticationResult(
                AuthenticationResult::SUCCESS,
                $resultIdentity
            );
        }

        return $this->authenticateCreateAuthResult();
    }
682637
public function getIdentity($spec = null, $default = null)
    {
        if ($spec !== null) {
            return isset($this->identity[$spec]) ? $this->identity[$spec] : $default;
        } else {
            return $this->identity;
        }
    }
1341568
final protected function verifyResult($result)
    {
        $returnType = $this->returnType;
        if ($returnType === null) {
            if ($result !== null) {
                throw TypeMismatchException::format(
                        'Invalid return type from action handler %s: expecting null, %s given',
                        get_class($this), Debug::getType($result)
                );
            }

            return $result;
        }

        if (!($result instanceof $returnType)) {
            throw TypeMismatchException::format(
                    'Invalid return value from action handler %s: expecting %s, %s given',
                    get_class($this), $returnType, Debug::getType($result)
            );
        }

        return $result;
    }
1075383
public function setVerificationResult(\AgentSIB\Diadoc\Api\Proto\SignatureVerificationResult $value = null)
    {
        $this->VerificationResult = $value;
    }
1242668
protected function getInsertObjectIdentitySql($identifier, $classId, $entriesInheriting)
    {
        $query = <<<QUERY
              INSERT INTO %s (class_id, object_identifier, entries_inheriting)
              VALUES (%d, %s, %s)
QUERY;

        return sprintf(
            $query,
            $this->options['oid_table_name'],
            $classId,
            $this->connection->quote($identifier),
            $this->connection->getDatabasePlatform()->convertBooleans($entriesInheriting)
        );
    }
334130
protected function marshalZendResult(Result $result): AuthenticationResult
    {
        $code = Utils::$authResultCodeMap[$result->getCode()];
        //we'll give the user only general error info, to prevent user enumeration attacks
        $message = Utils::$authCodeToMessage[$code];

        $identity = null;
        if ($result->isValid()) {
            $identity = $result->getIdentity();
            //try to convert to array if not already...
            $identity = (array)$identity;
            if (empty($identity)) {
                throw new RuntimeException("Missing identity object or cannot be converted to array");
            }

            $identity = $this->hydrateIdentity($identity);
        }

        return new AuthenticationResult($code, $message, $identity);
    }
1219023
public function findStandardIdentityByIdentifier(string $identifier): Entity\StandardIdentity
    {
        $identity = new Entity\StandardIdentity;
        $identity->setIdentifier($identifier);

        $this->repository->load($identity);

        if ($identity->getId() === null) {
            $this->logger->notice('identity not found', [
                'input' => [
                    'identifier' => $identifier,
                ],
            ]);

            throw new IdentityNotFound;
        }

        return $identity;
    }
154178
protected function _authenticateValidateResultSet(array $resultIdentities)
    {
        if (count($resultIdentities) < 1) {
            $this->_authenticateResultInfo['code'] = \Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
            $this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
            return $this->_authenticateCreateAuthResult();
        } elseif (count($resultIdentities) > 1) {
            $this->_authenticateResultInfo['code'] = \Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS;
            $this->_authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.';
            return $this->_authenticateCreateAuthResult();
        }

        return true;
    }
1144993
public function tryGetByIdentifier(Identifier $identifier)
    {
        $mapId     = $identifier->getSerialized();
        $className = $identifier->class->getName();

        if (!isset($this->identityMap[$className][$mapId])) {
            return false;
        }

        return $this->identityMap[$className][$mapId];
    }
110459
public function authenticate()
    {
        $e = $this->getEvent();

        $result = new Result(
            $e->getCode(),
            $e->getIdentity(),
            $e->getMessages()
        );

        $this->resetAdapters();

        return $result;
    }
419333
public function getIdentity()
    {
        if ($this->_result === null || !$this->_result->isValid()) {
            return null;
        }

        $identity = $this->_result->getData();
        if (!($identity instanceof IdentityInterface)) {
            $identity = $this->buildIdentity($identity);
        }

        return $identity;
    }
762479
public function has(string $entryIdentifier): bool
    {
        $this->connect();

        $statementHandle = $this->databaseHandle->prepare('SELECT COUNT("identifier") FROM "' . $this->cacheTableName . '" WHERE "identifier"=? AND "context"=? AND "cache"=?' . $this->getNotExpiredStatement());
        $statementHandle->execute([$entryIdentifier, $this->context(), $this->cacheIdentifier]);
        return ($statementHandle->fetchColumn() > 0);
    }
967282
public function retrieveById($identifier) {
        if (!$this->isValidIdentifierValue($identifier)) {
            return null;
        }
        /** @var RecordInterface $user */
        $user = $this->createEmptyUserRecord()->fromPrimaryKey($identifier, [], $this->getRelationsToFetch());

        return $this->validateUser($user, null);
    }
744795
public function supports(DocumentIdentity $identity)
    {
        foreach ($this->indexers as $indexer) {
            if ($indexer->supports($identity)) {
                return true;
            }
        }

        return false;
    }
614185
public function authenticate() {
        /* Anti Injection de login */
        $login1 = Security\AntiInjection::antiSqlInjection1($this->getIdentity());
        $login2 = Security\AntiInjection::antiSqlInjection2($login1);
        $identity = Security\AntiInjection::antiSqlInjection3($login2);

        /* Anti Injection de senha */
        $senha1 = Security\AntiInjection::antiSqlInjection1($this->getCredential());
        $senha2 = Security\AntiInjection::antiSqlInjection2($senha1);
        $senha3 = Security\AntiInjection::antiSqlInjection3($senha2);

        /* Criptografa a senha */
        $crypt = new Security\Crypt();
        $credential = $crypt->encrypt($senha3);

        //Define os dados para processar o login
        $this->setIdentity($identity)->setCredential($credential);

        //Faz inner join dos dados do perfil no SELECT do Auth_Adapter
        $select = $this->getDbSelect();

        if (!empty($this->whereConditions)) {
            foreach ($this->whereConditions as $valueWhereConditions) {
                $select->where($valueWhereConditions);
            }
        }

        //Efetua o login
        $result = parent::authenticate();

        //Verifica se o login foi efetuado com sucesso
        if ($result->isValid()) {
            //Recupera o objeto do usuário, sem a senha
            $info = $this->getResultRowObject($this->returnColumns, $this->credentialColumn);

            $storage = new SessionStorage();
            $storage->write($info);

            if ($result->getCode()) {
                return new ResultValidation(ResultValidation::SUCCESS, ((array) $info));
            } else {
                return new ResultValidation(ResultValidation::FAILURE, null);
            }
        } else {
            return new ResultValidation(ResultValidation::FAILURE, null);
        }
    }
327263
public boolean validateSignature(final Pair<Assertion, WsFederationConfiguration> resultPair) {
        if (resultPair == null) {
            LOGGER.warn("No assertion or its configuration was provided to validate signatures");
            return false;
        }
        val configuration = resultPair.getValue();
        val assertion = resultPair.getKey();

        if (assertion == null || configuration == null) {
            LOGGER.warn("No signature or configuration was provided to validate signatures");
            return false;
        }
        val signature = assertion.getSignature();
        if (signature == null) {
            LOGGER.warn("No signature is attached to the assertion to validate");
            return false;
        }

        try {
            LOGGER.debug("Validating the signature...");
            val validator = new SAMLSignatureProfileValidator();
            validator.validate(signature);

            val criteriaSet = new CriteriaSet();
            criteriaSet.add(new UsageCriterion(UsageType.SIGNING));
            criteriaSet.add(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME));
            criteriaSet.add(new ProtocolCriterion(SAMLConstants.SAML20P_NS));
            criteriaSet.add(new EntityIdCriterion(configuration.getIdentityProviderIdentifier()));
            try {
                val engine = buildSignatureTrustEngine(configuration);
                LOGGER.debug("Validating signature via trust engine for [{}]", configuration.getIdentityProviderIdentifier());
                return engine.validate(signature, criteriaSet);
            } catch (final SecurityException e) {
                LOGGER.warn(e.getMessage(), e);
            }
        } catch (final SignatureException e) {
            LOGGER.error("Failed to validate assertion signature", e);
        }

        SamlUtils.logSamlObject(this.configBean, assertion);

        LOGGER.error("Signature doesn't match any signing credential and cannot be validated.");
        return false;
    }
253061
protected function processI(array $result) {
		$entity = df_ic($this->entityC(), O::class, $result); /** @var O $entity */
		$entity->validate();
		return $result;
	}