Get the currently authenticated acct.

@return Account|null
776166
public function acct()
	{
		// If we've already retrieved the acct for the current request we can just
		// return it back immediately. We do not want to fetch the acct data on
		// every call to this method because that would be tremendously slow.
		if ( !is_null( $this->acct ) )
			return $this->acct;

		$acct = null;

		$token = $this->getTokenForRequest();

		if ( !empty( $token ) )
			$acct = $this->auth->retrieveByCredentials( [$this->storageKey => $token] );

		return $this->acct = $acct;
	}
513500
public function getAccessTokenByAuth()
    {
        if ($this->accessToken) {
            return $this->accessToken;
        }

        if ($this->authed) {
            $this->accessToken = $this->wechatComponentApi->getAuthorizerAccessToken(
                $this->getAppId(),
                $this->getRefreshToken()
            );
        } else {
            $this->getAccessToken();
        }

        return $this->accessToken;
    }
1197162
protected function _getAuth() {
		if ($this->auth) {
			return $this->auth;
		}

		$authAllow = Cache::read($this->getConfig('allowCacheKey'), $this->getConfig('cache'));
		if (!$authAllow) {
			//TOOD make refactor to collect data at runtime? Should not be necessary if AuthComponent is used properly.
			throw new Exception('Cache for Authentication data not found. This is required for `includeAuthentication` as true. Make sure you enabled TinyAuth.AuthComponent.');
		}

		$this->auth = $authAllow;

		return $authAllow;
	}
1060404
public function account()
    {
        $this->logger->debug("account: start");

        if (empty($this->access_key)) {
            throw new \Exception("access key not set");
        }

        $accountUrl = sprintf("%s/%s", $this->api_url, "account");
        $client = new \GuzzleHttp\Client();

        $result = $client->post($accountUrl, array(
            'multipart' => array(
                array(
                    'name' => 'accesskey',
                    'contents' => $this->access_key
                )
            ),
            'timeout' => $this->timeout
        ));

        $contents = $result->getBody()->getContents();
        $data = json_decode($contents, true);

        // check for non zero staus codes
        if (isset($data['flag']) && $data['flag'] > 0) {
            throw new \Exception($data['errortext']);
        }

        return $data;
    }
306955
public function authenticate()
    {
        $u = $this->authenticateBySession();
        if ($u) {
            return $u;
        }

        $u = $this->authenticateByToken();
        if ($u) {
            return $u;
        }

        return null;
    }
281477
public function getLoggedUser()
    {
        $credentials = $this->storage->getLoggedUser();

        return is_array($credentials) ? new User($credentials) : null;
    }
1188760
public function getCurrentAccount()
    {
        $this->currentAccount || $this->currentAccount = wei()->wechatAccount()->cache()->curApp()->findOrInit(false);

        return $this->currentAccount;
    }
146626
protected function authenticate()
    {
        $authClass = $this->config()->authenticator;
        $member = $authClass::authenticate();
        Security::setCurrentUser($member);
        return $member;
    }
627472
public static function CurrentUser()
    {
        if (static::IsAuthenticatedRequest()) {
            $cryptor = new GnCryptor();
            $cookie = $cryptor->decrypt($_COOKIE['GpsNoseAuthentication']);
            $json = json_decode($cookie);
            $gnPrincipal = new GnPrincipal();
            $gnPrincipal->LoginName = $json->{"LoginName"};
            $gnPrincipal->LoginId = $json->{"LoginId"};
            $gnPrincipal->ProfileTags = $json->{"ProfileTags"};
            return $gnPrincipal;
        }
        return NULL;
    }
575719
public function getOwner()
    {
        $uuid = $this->getProperty('owner');
        $url = $this->makeAbsoluteUrl('/api/users', $this->getLink('project'));
        return Account::get($uuid, $url, $this->client);
    }
1137350
public function getCurrentUser()
    {
        if ($this->currentuser === null) {
            $this->currentuser = $this->app['session']->isStarted() ? $this->app['session']->get('authentication') : null;
            if ($this->currentuser instanceof AccessControl\Token\Token) {
                $this->currentuser = $this->currentuser->getUser()->toArray();
            }
        }

        return $this->currentuser;
    }
115961
public function getAuthentication()
    {
        if ($this->useAgent) {
            return $this->getAgent();
        }

        if ($this->privateKey) {
            return $this->getPrivateKey();
        }

        return $this->getPassword();
    }
501730
public function getAccountInfo()
    {
        $url = self::REST_ACCOUNT_INFO;
        $this->setUrl($url)
            ->setVerb('GET');

        $response = $this->execute();
        if (isset($response->message)) {
            $message = 'GET ACCOUNT INFO for api user : '
                . $this->getApiUsername() . ' ' . $response->message;
            $this->helper->debug('getAccountInfo', [$message]);
        }

        return $response;
    }
219752
protected function getAuth()
    {
        if (is_null($this->auth)) {
            $this->auth = app($this->config('auth'));
        }

        return $this->auth;
    }
1257786
public function getAccounts()
    {
        $accounts = $this->serviceHelper->getService()->management_accounts->listManagementAccounts()->getItems();
        $data = array();

        foreach ($accounts as $account) {
            $data[$account->getName()] = array(
                    'accountId' => $account->getId(),
                    'accountName' => $account->getName(),
                );
        }
        ksort($data);

        return $data;
    }
561245
public function getAccessToken() {
    $token = self::$auth->getAccessToken();
    return (null == $token || 'null' == $token) ? null : $token;
  }
1171506
public function id()
	{
		if ( $this->loggedOut )
			return null;

		$id = $this->session->get( $this->getName() );

		if ( is_null( $id ) && $this->acct() )
			$id = $this->acct()->getId();

		return $id;
	}