获取授权方的选项设置信息
@param string $authorizer_appid
@param string $option_name
@return bool
326234
public function getAuthorizerOption($authorizer_appid, $option_name)
    {
        empty($this->component_access_token) && $this->getComponentAccessToken();
        if (empty($this->authorizer_appid)) {
            return false;
        }
        $data = array();
        $data['component_appid'] = $this->component_appid;
        $data['authorizer_appid'] = $authorizer_appid;
        $data['option_name'] = $option_name;
        $url = self::URL_PREFIX . self::GET_AUTHORIZER_OPTION_URL . "?component_access_token={$this->component_access_token}";
        $result = Tools::httpPost($url, Tools::json_encode($data));
        if (($result = $this->_decode($result)) === false) {
            Tools::log("Get getAuthorizerOption Faild. {$this->errMsg} [$this->errCode]", "ERR - {$this->authorizer_appid}");
        }
        return $result;
    }
1219613
public function getAuthorizationInfo($authorization_code)
    {
        empty($this->component_access_token) && $this->getComponentAccessToken();
        if (empty($this->component_access_token)) {
            return false;
        }
        $data = array();
        $data['component_appid'] = $this->component_appid;
        $data['authorization_code'] = $authorization_code;
        $url = self::URL_PREFIX . self::QUERY_AUTH_URL . "?component_access_token={$this->component_access_token}";
        $result = Tools::httpPost($url, Tools::json_encode($data));
        $authorization_info = $this->_decode($result, 'authorization_info');
        if (empty($authorization_info)) {
            Tools::log("Get getAuthorizationInfo Faild. {$this->errMsg} [$this->errCode]", "ERR - {$this->authorizer_appid}");
            return false;
        }
        $authorization_info['func_info'] = $this->_parseFuncInfo($authorization_info['func_info']);
        return $authorization_info;
    }
820984
static <T> CompletionStage<Boolean> authorize(Authorizer<T> authorizer, ServiceRequestContext ctx, T data) {
        try {
            final CompletionStage<Boolean> f = authorizer.authorize(ctx, data);
            if (f == null) {
                throw new NullPointerException("An " + Authorizer.class.getSimpleName() +
                                               " returned null: " + authorizer);
            }
            return f;
        } catch (Throwable cause) {
            return CompletableFutures.exceptionallyCompletedFuture(cause);
        }
    }
946575
public function getAuthorizerInfo($authorizerCorpId, $permanentCode)
    {
        $params = [
            'suite_id'       => $this->getSuiteId(),
            'auth_corpid'    => $authorizerCorpId,
            'permanent_code' => $permanentCode,
        ];

        return $this->parseJSON('json', [self::GET_AUTH_INFO, $params]);
    }
992475
public function setAuthorizerOption($authorizer_appid, $option_name, $option_value)
    {
        empty($this->component_access_token) && $this->getComponentAccessToken();
        if (empty($this->authorizer_appid)) {
            return false;
        }
        $data = array();
        $data['component_appid'] = $this->component_appid;
        $data['authorizer_appid'] = $authorizer_appid;
        $data['option_name'] = $option_name;
        $data['option_value'] = $option_value;
        $url = self::URL_PREFIX . self::SET_AUTHORIZER_OPTION_URL . "?component_access_token={$this->component_access_token}";
        $result = Tools::httpPost($url, Tools::json_encode($data));
        if (($result = $this->_decode($result)) === false) {
            Tools::log("Get setAuthorizerOption Faild. {$this->errMsg} [$this->errCode]", "ERR - {$this->authorizer_appid}");
        }
        return $result;
    }
511432
public function setAuthorizerOption(string $appId, string $name, string $value)
    {
        $params = [
            'component_appid' => $this->app['config']['app_id'],
            'authorizer_appid' => $appId,
            'option_name' => $name,
            'option_value' => $value,
        ];

        return $this->httpPostJson('cgi-bin/component/api_set_authorizer_option', $params);
    }
864510
public function getAuthorizerInfo($authorizer_appid)
    {
        $params = array(
            'component_appid'  => $this->appid,
            'authorizer_appid' => $authorizer_appid,
        );

        return $this->http->jsonPost(self::API_GET_AUTHORIZER_INFO, $params);
    }
78333
public static String keyParam(String component_appid, String authorizer_appid) {
		return String.format("%s%s%s", component_appid, KEY_JOIN, authorizer_appid);
	}
1093940
public function getAuthorizer(string $appId)
    {
        $params = [
            'component_appid' => $this->app['config']['app_id'],
            'authorizer_appid' => $appId,
        ];

        return $this->httpPostJson('cgi-bin/component/api_get_authorizer_info', $params);
    }
221707
public function info($appId) {
        $data = $this->getInfo()->parameters([
            'authorizer_appid' => $appId
        ])->json();
        if (!array_key_exists('authorizer_info', $data)) {
            throw new \Exception('INFO ERROR!');
        }
        $this->set($data['authorizer_info']);
        return $data['authorizer_info'];
    }
876479
def refresh_authorizer_token(
            self, authorizer_appid, authorizer_refresh_token):
        
        return self.post(
            '/component/api_authorizer_token',
            data={
                'component_appid': self.component_appid,
                'authorizer_appid': authorizer_appid,
                'authorizer_refresh_token': authorizer_refresh_token
            }
        )
887891
public function refreshAccessToken($authorizer_appid, $authorizer_refresh_token)
    {
        empty($this->component_access_token) && $this->getComponentAccessToken();
        if (empty($this->component_access_token)) {
            return false;
        }
        $data = array();
        $data['component_appid'] = $this->component_appid;
        $data['authorizer_appid'] = $authorizer_appid;
        $data['authorizer_refresh_token'] = $authorizer_refresh_token;
        $url = self::URL_PREFIX . self::REFRESH_ACCESS_TOKEN . "?component_access_token={$this->component_access_token}";
        $result = Tools::httpPost($url, Tools::json_encode($data));
        if (($result = $this->_decode($result)) === false) {
            Tools::log("Get getAuthorizerOption Faild. {$this->errMsg} [$this->errCode]", "ERR - {$this->authorizer_appid}");
        }
        return $result;
    }
622374
public function authorizerToken($authorizerAppId, $authorizerRefreshToken)
    {
        return $this->auth(function () use ($authorizerAppId, $authorizerRefreshToken) {
            return $this->callHttp([
                'url' => 'api_authorizer_token?component_access_token=' . $this->accessToken,
                'data' => [
                    'component_appid' => $this->getAppId(),
                    'authorizer_appid' => $authorizerAppId,
                    'authorizer_refresh_token' => $authorizerRefreshToken,
                ],
            ]);
        });
    }
464880
protected function executeCustom($appId, $action, $object = null, $class = null)
    {
        return $this->requestAction(RequestOps::EXECUTE, $action, null, null, $object, $class, $appId);
    }
287759
function ProviderAuthError (options, status) {
  if (!status) {
    switch (options.error) {
      case 'access_denied': status = 403
        break
      case 'server_error': status = 502
        break
      case 'temporarily_unavailable': status = 503
        break
    }
  }

  this.name = 'ProviderAuthError'
  this.code = options.error || 'server_error'
  this.message = options.error_description
  this.status = status || 500
}
326270
public static function getJsapiTicket($app_id, $app_secret) {
        $urlObj = array();
        $urlObj['appid'] = $app_id;
        $urlObj['secret'] = $app_secret;
        $urlObj['grant_type'] = 'client_credential';
        $queryStr = http_build_query($urlObj);
        $accessTokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?' . $queryStr;
        $resp = self::_getRequest($accessTokenUrl);
        $resp = json_decode($resp, true);
        if (!is_array($resp) || isset($resp['errcode'])) {
            return $resp;
        }

        $urlObj = array();
        $urlObj['access_token'] = $resp['access_token'];
        $urlObj['type'] = 'jsapi';
        $queryStr = http_build_query($urlObj);
        $jsapiTicketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?' . $queryStr;
        $resp = self::_getRequest($jsapiTicketUrl);

        return json_decode($resp, true);
    }
178959
@Post("/tokens")
    @StatusCode(201)
    @ResponseConverter(CreateApiResponseConverter.class)
    public CompletableFuture<HttpResult<Token>> createToken(@Param("appId") String appId,
                                                                    @Param("isAdmin") boolean isAdmin,
                                                                    Author author, User loginUser) {
        checkArgument(!isAdmin || loginUser.isAdmin(),
                      "Only administrators are allowed to create an admin-level token.");
        return mds.createToken(author, appId, isAdmin)
                  .thenCompose(unused -> mds.findTokenByAppId(appId))
                  .thenApply(token -> {
                      final HttpHeaders headers = HttpHeaders.of(HttpStatus.CREATED)
                                                             .add(HttpHeaderNames.LOCATION, "/tokens/" + appId);
                      return HttpResult.of(headers, token);
                  });
    }