Get verification status.

@param string[] $identities List of string. (email or domain)

@return object[] {
Email  => string,
Token  => string,
Status => string
}
510119
public function getIdentityVerificationAttributes($identities)
    {
        $this->_action = 'GetIdentityVerificationAttributes';
        $this->_method = 'GET';
        $this->_refreshDate();

        $parameters = array();

        $index = 1;
        if (is_array($identities)) {
            foreach ($identities as $identity) {
                if (!(filter_var($identity, FILTER_VALIDATE_EMAIL) || preg_match('/^([a-z\d]+(-[a-z\d]+)*\.)+[a-z]{2,}$/', $identity))) {
                    throw new Exception('Identity must be EmailAddress or Domain');
                    return;
                }
                $parameters['Identities.member.' . $index] = $identity;
                $index++;
            }
        }

        $this->_generateSignature($parameters);
        $res = $this->_request();
        if ($res['code'] == 200) {
            $entries = $res['body']->GetIdentityVerificationAttributesResult->VerificationAttributes->entry;
            $ret = array();
            foreach ($entries as $entry) {
                $ret[] = array(
                    'Email' => (string) $entry->key,
                    'Token' => (string) $entry->value->VerificationToken,
                    'Status' => (string) $entry->value->VerificationStatus
                );
            }
            return $ret;
        } else {
            return new SimpleEmailServiceError((string) $res['body']->Error->Code);
        }
    }
703331
function checkIdentifierGivenToAnyUser(array $identifiers)
    {
        $response = $this->call( new Command\Members\Exists($identifiers) );
        if ( $ex = $response->hasException() )
            throw $ex;

        $r = $response->expected();
        $r = ($r instanceof iDataEntity) ? $r->get('result') : $r;
        return $r;
    }
73910
protected function getTokenCredentials() {
        return [
            'server' => $this->settings->getServiceEndpoint( 'sts' ),
            'endpoint' => $this->settings->getAuthenticationEndpoint(),
            'username' => $this->settings->username,
            'password' => $this->settings->password,
        ];
    }
184436
public function stateFor(Identity $identity): State
    {
        foreach ($this->states as $state => $entities) {
            if ($entities->contains($identity)) {
                return $state;
            }
        }

        throw new IdentityNotManaged;
    }
778283
public function checkAccountStatus($username)
    {
        $statusCodes = [
            0 => 'UNVERIFIED',
            1 => 'VERIFIED',
            2 => 'CERTIFIED',
            3 => 'CERTIFIED_PREMIUM',
        ];

        if (false !== ($response = $this->request('api/CekStatus.php', ['user' => $username]))) {
            return $statusCodes[ $response[ 'StatusUser' ] ];
        }

        return false;
    }
1095757
public function name($identities)
	{
		$ids = $this->extractIds($identities);
		$ids = implode(',', $ids);

		$array = $this->request('summoner/'.$ids.'/name');
		$names = [];
		foreach ($array as $id => $name)
		{
			$names[$id] = $name;
		}

		return $names;
	}
1356881
public function request($inputs)
    {
        $result = $this->restCall('PaymentRequest.json', $inputs);

        if ($result['Status'] == 100 || $result['Status'] == 101) {
            return ['Authority' => $result['Authority']];
        } else {
            return ['error' => $result['Status']];
        }
    }
175644
private function loadStateIdentifiers(): array
    {
        if ($this->stateIdentifiers === null) {
            $this->stateIdentifiers = $this->repository->sudo(
                static function (Repository $repository): array {
                    $stateIdentifiers = [];

                    $stateGroups = $repository->getObjectStateService()->loadObjectStateGroups();
                    foreach ($stateGroups as $stateGroup) {
                        $stateIdentifiers[$stateGroup->identifier] = [];

                        $states = $repository->getObjectStateService()->loadObjectStates($stateGroup);
                        foreach ($states as $state) {
                            $stateIdentifiers[$stateGroup->identifier][] = $state->identifier;
                        }
                    }

                    return $stateIdentifiers;
                }
            );
        }

        return $this->stateIdentifiers;
    }
46558
public function getRealms(array $realms = array())
    {
        if (empty($realms)) {
            $response = $this->get('realm/status');
        } else {
            $this->setQueryParam('realms', implode(',', $realms));
            $response = $this->get('realm/status');
        }

        if(empty($realms) || count($response['realms']) === count($realms)) {
            return $response['realms'];
        } else {
            return false;
        }
    }
45053
private function getObjectStateIds(array $stateIdentifiers): array
    {
        $idList = [];

        foreach ($stateIdentifiers as $identifier) {
            $identifier = explode('|', $identifier);
            if (count($identifier) !== 2) {
                continue;
            }

            try {
                $stateGroup = $this->objectStateHandler->loadGroupByIdentifier($identifier[0]);
                $objectState = $this->objectStateHandler->loadByIdentifier($identifier[1], $stateGroup->id);
                $idList[$stateGroup->id][] = $objectState->id;
            } catch (NotFoundException $e) {
                continue;
            }
        }

        return $idList;
    }
286781
public static function verify($password, $rules, $user, $name=null, $isNew=true)
	{
		if (empty($rules))
		{
			return array();
		}

		$fail = array();

		$stats = self::analyze($password);

		foreach ($rules as $rule)
		{
			if ($rule['rule'] == 'minCharacterClasses')
			{
				if ($stats['uniqueClasses'] < $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'maxCharacterClasses')
			{
				if ($stats['uniqueClasses'] > $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'minPasswordLength')
			{
				if ($stats['count'][0] < $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'maxPasswordLength')
			{
				if ($stats['count'][0] > $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'maxClassCharacters')
			{
				if (empty($rule['class']))
				{
					continue;
				}

				$class = $rule['class'];

				if (empty($stats['count'][$class]))
				{
					$stats['count'][$class] = 0;
				}

				if ($stats['count'][$class] > $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'minClassCharacters')
			{
				if (empty($rule['class']))
				{
					continue;
				}

				$class = $rule['class'];

				if (empty($stats['count'][$class]))
				{
					$stats['count'][$class] = 0;
				}

				if ($stats['count'][$class] < $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'minUniqueCharacters')
			{
				if ($stats['uniqueCharacters'] < $rule['value'])
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'notBlacklisted')
			{
				if (Blacklist::basedOnBlackList($password))
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'notNameBased')
			{
				if ($name == null)
				{
					if (is_numeric($user))
					{
						$xuser = User::oneOrNew($user);
					}
					else
					{
						$xuser = User::oneByUsername($user);
					}

					if (!is_object($xuser))
					{
						continue;
					}

					$givenName  = $xuser->get('givenName');
					$middleName = $xuser->get('middleName');
					$surname    = $xuser->get('surname');

					$name = $givenName;

					if (!empty($middleName))
					{
						if (empty($name))
						{
							$name = $middleName;
						}
						else
						{
							$name .= ' ' . $middleName;
						}
					}

					if (!empty($surname))
					{
						if (empty($name))
						{
							$name = $surname;
						}
						else
						{
							$name .= ' ' . $surname;
						}
					}
				}

				if (self::isBasedOnName($password, $name))
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'notUsernameBased')
			{
				if (is_numeric($user))
				{
					$xuser = User::oneOrNew($user);

					if (!is_object($xuser))
					{
						continue;
					}

					$user = $xuser->get('username');
				}

				if (self::isBasedOnUsername($password, $user))
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'notReused')
			{
				$date = new \DateTime('now');
				$date->modify("-" . $rule['value'] . "day");

				$phist = History::getInstance($user);
				if (!is_object($phist))
				{
					continue;
				}

				if ($phist->exists($password, $date->format("Y-m-d H:i:s")))
				{
					$fail[] = $rule['failuremsg'];
				}

				$current = Password::getInstance($user);

				// [HUBZERO][#10274] Check the current password too
				if ($isNew && Password::passwordMatches($user, $password, true))
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] == 'notRepeat')
			{
				if (Password::passwordMatches($user, $password, true))
				{
					$fail[] = $rule['failuremsg'];
				}
			}
			else if ($rule['rule'] === 'true')
			{
			}
			else if ($rule['rule'] == 'notStale')
			{
			}
			else
			{
				$fail[] = $rule['failuremsg'];
			}
		}

		if (empty($fail))
		{
			$fail = array();
		}

		return $fail;
	}
687207
private function getInstancesList(array $ids)
    {
        $statuses = $instances = $classes = [];

        foreach ($ids as $key => $instance) {
            $instance = $this->getResource($instance);
            if ($instance->isClass()) {
                $instance = $this->getClass($instance);
                $classes[] = $instance;
            } elseif (!$instance->exists()) {
                $statuses[$instance->getUri()] = [
                    'success' => false,
                    'message' => sprintf('Instance "%s" does not exist', $instance->getUri()),
                ];
                break;
            }
            $instances[$key] = $instance;
        }

        return [
            $statuses,
            $instances,
            $classes
        ];
    }
571030
public function status()
    {
        $auth       = $this->getAuthenticationService();
        $loggedIn   = $auth->hasIdentity();
        $identity   = $loggedIn ? $auth->getIdentity() : null;

        return (object) array(
            'loggedIn'      => $loggedIn,
            'id'            => $loggedIn ? $identity->id            : null,
            'email'         => $loggedIn ? $identity->email         : null,
            'displayName'   => $loggedIn ? $identity->displayName   : null,
        );
    }
507280
public function findByIds(array $ids)
    {
        $entities = [];

        for ($i = 0; $i < count($this->registries); $i++) {
            /** @var RegistryInterface $registry */
            $registry = $this->registries[ $i ];
            $found = $registry->findByKeys($ids);
            $entities = array_merge($entities, $found);

            $this->updateRegistries($found, $i - 1);

            if (count($entities) === count($ids)) {
                break;
            }
        }

        return $entities;
    }
1137473
protected function validateIdentity($identity)
    {
        $options = $this->options;
        $credential = $options
            ->getCredentialRepository()
            ->findOneBy([
                $options->getCredentialIdentityProperty() => $identity,
                $options->getCredentialTypeProperty() => $options->getCredentialType()
            ]);

        if (!$credential) {
            $this->authenticationResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND;
            $this->authenticationResultInfo['messages'][] = 'A record with the supplied credential could not be found.';

            return $this->createAuthenticationResult();
        }

        $credentialIdentityProperty = $this->options->getCredentialIdentityProperty();
        $getter = 'get' . ucfirst($credentialIdentityProperty);
        $credentialIdentity = null;

        if (method_exists($credential, $getter)) {
            $credentialIdentity = $credential->$getter();
        } elseif (property_exists($credential, $credentialIdentityProperty)) {
            $credentialIdentity = $credential->{$credentialIdentityProperty};
        } else {
            throw new Exception\UnexpectedValueException(
                sprintf(
                    'Property (%s) in (%s) is not accessible. You should implement %s::%s()',
                    $credentialIdentityProperty,
                    get_class($credential),
                    get_class($credential),
                    $getter
                )
            );
        }

        $callable = $this->options->getCredentialCallable();
        if ($callable) {
            $credentialValid = call_user_func($callable, $identity, $credential, $this->credential);
        } else {
            $credentialProperty = $options->getCredentialProperty();
            $getter = 'get' . ucfirst($credentialProperty);
            $credentialValue = null;

            if (method_exists($credential, $getter)) {
                $credentialValue = $credential->$getter();
            } elseif (property_exists($credential, $credentialProperty)) {
                $credentialValue = $credential->{$credentialProperty};
            } else {
                throw new Exception\UnexpectedValueException(
                    sprintf(
                        'Property (%s) in (%s) is not accessible. You should implement %s::%s()',
                        $credentialProperty,
                        get_class($credential),
                        get_class($credential),
                        $getter
                    )
                );
            }

            $credentialValid = $identity === $credentialIdentity && $this->credential === $credentialValue;
        }

        if ($credentialValid !== true) {
            $this->authenticationResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID;
            $this->authenticationResultInfo['messages'][] = 'Supplied credential is invalid.';

            return $this->createAuthenticationResult();
        }

        $this->authenticationResultInfo['code'] = AuthenticationResult::SUCCESS;
        $this->authenticationResultInfo['identity'] = $identity;
        $this->authenticationResultInfo['messages'][] = 'Authentication successful.';

        return $this->createAuthenticationResult();
    }
1263508
public static function listOriginAccessIdentities()
	{
		if (!extension_loaded('openssl'))
		{
			self::__triggerError(sprintf("S3::listOriginAccessIdentities(): [%s] %s",
			"CloudFront functionality requires SSL"), __FILE__, __LINE__);
			return false;
		}

		self::$useSSL = true; // CloudFront requires SSL
		$rest = new S3Request('GET', '', '2010-11-01/origin-access-identity/cloudfront', 'cloudfront.amazonaws.com');
		$rest = self::__getCloudFrontResponse($rest);
		$useSSL = self::$useSSL;

		if ($rest->error === false && $rest->code !== 200)
			$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
		if ($rest->error !== false)
		{
			trigger_error(sprintf("S3::listOriginAccessIdentities(): [%s] %s",
			$rest->error['code'], $rest->error['message']), E_USER_WARNING);
			return false;
		}

		if (isset($rest->body->CloudFrontOriginAccessIdentitySummary))
		{
			$identities = array();
			foreach ($rest->body->CloudFrontOriginAccessIdentitySummary as $identity)
				if (isset($identity->S3CanonicalUserId))
					$identities[(string)$identity->Id] = array('id' => (string)$identity->Id, 's3CanonicalUserId' => (string)$identity->S3CanonicalUserId);
			return $identities;
		}
		return false;
	}
357122
private function getFederatedSignOnCerts() {
    // This relies on makeRequest caching certificate responses.
    $request = Client::$io->makeRequest(new HttpRequest(
        self::OAUTH2_FEDERATED_SIGNON_CERTS_URL));
    if ($request->getResponseHttpCode() == 200) {
      $certs = json_decode($request->getResponseBody(), true);
      if ($certs) {
        return $certs;
      }
    }
    throw new AuthException(
        "Failed to retrieve verification certificates: '" .
            $request->getResponseBody() . "'.",
        $request->getResponseHttpCode());
  }