通过应用名称或者应用ID获取一个应用的详情信息。

@param string $identity 要查询的应用名称或者应用ID，如果应用有多个版本，则指定应用名称为当前应用的在线版本。
@return \OpenSearch\Generated\Common\OpenSearchResult
187734
public function getById($identity) {
        $path = $this->path . "/" . $identity;
        return $this->openSearchClient->get($path);
    }
1167433
public function createPreAuthCode($identification)
    {
        $cacheKey = sprintf($this->preAuthCodeCacheKey, $identification);

        return Cache::get($cacheKey, function () use ($cacheKey) {
            $response = $this->http->jsonPost(self::API_CREATE_PREAUTHCODE, [
                'component_appid' => $this->appid,
            ]);

            $pre_auth_code = $response['pre_auth_code'];

            // 把pre_auth_code缓存起来
            $expiresAt = Carbon::now()->addSeconds($response['expires_in']);
            Cache::put($cacheKey, $pre_auth_code, $expiresAt);

            return $pre_auth_code;
        });
    }
982817
private function getIdIdentification(string $identification): int
    {
        $result = $this->connection->select('id')
            ->from($this->tableTranslateIdent)
            ->where(['ident' => $identification])
            ->fetchSingle();

        if (!$result) {
            $result = $this->connection->insert($this->tableTranslateIdent, [
                'ident' => $identification,
            ])->execute(Dibi::IDENTIFIER);  // must return last insert ID
        }
        return $result;
    }
682637
public function getIdentity($spec = null, $default = null)
    {
        if ($spec !== null) {
            return isset($this->identity[$spec]) ? $this->identity[$spec] : $default;
        } else {
            return $this->identity;
        }
    }
1058495
public function getContext($identity) {
        return new SyncMapPermissionContext(
            $this->version,
            $this->solution['serviceSid'],
            $this->solution['mapSid'],
            $identity
        );
    }
1170027
protected function _fetchCount(Identity $identity)
    {
        $this->_totalItemsCount = $this->_db->fetchOne($this->_getSelectCount($identity));
        return $this;
    }
2858
private function matchRelationship(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $name = $this->name->sprintf(\md5($identity->value()));
        $this->variables = $this->variables->add((string) $name);

        return $query
            ->match()
            ->linkedTo()
            ->through(
                (string) $meta->type(),
                (string) $name
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $name
                    ->prepend('{')
                    ->append('_identity}')
            )
            ->withParameter(
                (string) $name->append('_identity'),
                $identity->value()
            );
    }
929370
public function login($identity, $password)
    {
        try {
            $loginStatus = $this->attemptLogin($identity, $password);

            if ($loginStatus) {
                $this->createSuccessfulUserLoginAttempt($identity);
            }

            return $loginStatus;
        } catch (LoginDisabledException $loginDisabledException) {
            $this->createFailedUserLoginAttempt($identity, UserLog::USER_LOG_LOGIN_DISABLED);
            throw $loginDisabledException;
        } catch (LoginExpiredException $loginExpiredException) {
            $this->createFailedUserLoginAttempt($identity, UserLog::USER_LOG_LOGIN_EXPIRED);
            throw $loginExpiredException;
        } catch (LoginTemporarilyLockedOutException $loginDisabledFailedAttemptsException) {
            $this->createFailedUserLoginAttempt($identity, UserLog::USER_LOG_LOGIN_LOCKED);
            throw $loginDisabledFailedAttemptsException;
        } catch (CredentialsFailedException $credentialsFailedException) {
            $this->createFailedUserLoginAttempt($identity, UserLog::USER_LOG_LOGIN_FAILED);
            throw $credentialsFailedException;
        }
    }
473134
public function find($id, int $lockMode = LockMode::NONE, ?int $lockVersion = null) : ?object
    {
        if ($id === null) {
            return null;
        }

        /* TODO: What if the ID object has a field with the same name as the
         * class' mapped identifier field name?
         */
        if (is_array($id)) {
            [$identifierFieldName] = $this->class->getIdentifierFieldNames();

            if (isset($id[$identifierFieldName])) {
                $id = $id[$identifierFieldName];
            }
        }

        // Check identity map first
        $document = $this->uow->tryGetById($id, $this->class);
        if ($document) {
            if ($lockMode !== LockMode::NONE) {
                $this->dm->lock($document, $lockMode, $lockVersion);
            }

            return $document; // Hit!
        }

        $criteria = ['_id' => $id];

        if ($lockMode === LockMode::NONE) {
            return $this->getDocumentPersister()->load($criteria);
        }

        if ($lockMode === LockMode::OPTIMISTIC) {
            if (! $this->class->isVersioned) {
                throw LockException::notVersioned($this->documentName);
            }

            $document = $this->getDocumentPersister()->load($criteria);
            if ($document) {
                $this->uow->lock($document, $lockMode, $lockVersion);
            }

            return $document;
        }

        return $this->getDocumentPersister()->load($criteria, null, [], $lockMode);
    }
381456
protected function _createPlainToken($identity)
    {
        $usernameField = $this->getConfig('fields.username');
        $passwordField = $this->getConfig('fields.password');

        return $identity[$usernameField] . $identity[$passwordField];
    }
804279
protected function getQuery($identity)
    {
        $table = TableRegistry::get($this->tableAlias);
        $conditions = [$table->aliasField($this->identityColumn) => $identity];
        if (!empty($this->scope)) {
            $conditions = array_merge($conditions, $this->scope);
        }

        $query = $table->find('all')
            ->where($conditions);

        if (!empty($this->contain)) {
            $query = $query->contain($this->contain);
        }

        return $query;
    }
1269934
public function findIdentityById(int $identityId): Entity\Identity
    {
        $identity = new Entity\Identity;
        $identity->setId($identityId);

        $this->repository->load($identity, Entity\Identity::class);

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

            throw new IdentityNotFound;
        }

        return $identity;
    }
1282978
public function getDisplayNameByIdFromCache($id)
    {
        return wei()->arrayCache->get('nickName' . $id, function () use ($id) {
            $user = wei()->user()->find(['id' => $id]);

            return $user ? $user->getNickName() : '';
        });
    }
88102
private function findObjectIdentityId(ObjectIdentityInterface $objectIdentity)
    {
        if ($this->objectIds->contains($objectIdentity)) {
            return $this->objectIds->offsetGet($objectIdentity);
        }

        $conn = $this->getConnection();

        $qb = $conn->createQueryBuilder();
        $qb
            ->select('id')
            ->from('acl_object_identity')
            ->where($qb->expr()->eq('type', $qb->expr()->literal($objectIdentity->getType())))
            ->andWhere($qb->expr()->eq('identifier', $qb->expr()->literal($objectIdentity->getIdentifier())));

        $id = $qb->execute()->fetchColumn();

        if ($id) {
            $this->objectIds->attach($objectIdentity, $id);
        }

        return $id;
    }
1137009
public function setIdentity($identity = null)
    {
        if (null === $identity) {
            $this->setResult();
        }

        $this->setParam('identity', $identity);

        return $this;
    }
780722
public function setIdentityProperty($property)
    {
        $this->_identity_property = null;

        if (is_string($property)) {
            $property = $this->getProperty($property);
        }

        if ($property) {
            //an identitying property can be used as
            //an identifying property
            $this->addIdentifyingProperty($property);

            //don't allow direct write
            $property->setWriteAccess(AnDomain::ACCESS_PRIVATE);

            $this->_identity_property = $property;
        }

        return $this;
    }
1325216
public function findOneById($id)
    {
        $id = $this->idToMongo($id);

        if ($this->identityMap->has($id)) {
            return $this->identityMap->get($id);
        }

        return $this->createQuery(array('_id' => $id))->one();
    }