src/BaiduBce/Services/Sts/StsClient.php
public function getSessionToken($options = array())
    {
        list($config, $acl, $durationSeconds) =
            $this->parseOptions(
                $options,
                'config',
                'acl',
                'durationSeconds'
            );
		
        $params = array();
        if ($durationSeconds !== null) {
            $params['durationSeconds'] = $durationSeconds;
        }
        $headers = array();
        if ($acl !== null) {
            $headers[HttpHeaders::CONTENT_LENGTH] = strlen($acl);
        } else {
            $headers[HttpHeaders::CONTENT_LENGTH] = 0;
        }
        $headers[HttpHeaders::CONTENT_TYPE] = HttpContentTypes::JSON;
        // prevent low version curl add a default pragma:no-cache
        $headers[HttpHeaders::PRAGMA] = '';
        $config['endpoint'] = $this->stsEndpoint;
        $config = array_merge(
            $this->config,
            $config
        );
        $path = HttpUtils::appendUri(StsClient::STS_URL_PREFIX, StsClient::GET_SESSION_TOKEN_VERSION, StsClient::GET_SESSION_TOKEN_PATH);

        $response = $this->httpClient->sendRequest(
            $config,
            HttpMethod::POST,
            $path,
            $acl,
            $headers,
            $params,
            $this->signer
        );
		
        return $this->parseJsonResult($response['body']);
    }
public function getSessionToken($options = array())
    {
        list($config, $acl, $durationSeconds) =
            $this->parseOptions(
                $options,
                'config',
                'acl',
                'durationSeconds'
            );
		
        $params = array();
        if ($durationSeconds !== null) {
            $params['durationSeconds'] = $durationSeconds;
        }
        $headers = array();
        if ($acl !== null) {
            $headers[HttpHeaders::CONTENT_LENGTH] = strlen($acl);
        } else {
            $headers[HttpHeaders::CONTENT_LENGTH] = 0;
        }
        $headers[HttpHeaders::CONTENT_TYPE] = HttpContentTypes::JSON;
        // prevent low version curl add a default pragma:no-cache
        $headers[HttpHeaders::PRAGMA] = '';
        $config['endpoint'] = $this->stsEndpoint;
        $config = array_merge(
            $this->config,
            $config
        );
        $path = HttpUtils::appendUri(StsClient::STS_URL_PREFIX, StsClient::GET_SESSION_TOKEN_VERSION, StsClient::GET_SESSION_TOKEN_PATH);

        $response = $this->httpClient->sendRequest(
            $config,
            HttpMethod::POST,
            $path,
            $acl,
            $headers,
            $params,
            $this->signer
        );
		
        return $this->parseJsonResult($response['body']);
    }
public function getSessionToken ( $ options = array ( ) ) { list ( $ config , $ acl , $ durationSeconds ) = $ this -> parseOptions ( $ options , 'config' , 'acl' , 'durationSeconds' ) ; $ params = array ( ) ; if ( $ durationSeconds !== null ) { $ params [ 'durationSeconds' ] = $ durationSeconds ; } $ headers = array ( ) ; if ( $ acl !== null ) { $ headers [ HttpHeaders :: CONTENT_LENGTH ] = strlen ( $ acl ) ; } else { $ headers [ HttpHeaders :: CONTENT_LENGTH ] = 0 ; } $ headers [ HttpHeaders :: CONTENT_TYPE ] = HttpContentTypes :: JSON ; // prevent low version curl add a default pragma:no-cache $ headers [ HttpHeaders :: PRAGMA ] = '' ; $ config [ 'endpoint' ] = $ this -> stsEndpoint ; $ config = array_merge ( $ this -> config , $ config ) ; $ path = HttpUtils :: appendUri ( StsClient :: STS_URL_PREFIX , StsClient :: GET_SESSION_TOKEN_VERSION , StsClient :: GET_SESSION_TOKEN_PATH ) ; $ response = $ this -> httpClient -> sendRequest ( $ config , HttpMethod :: POST , $ path , $ acl , $ headers , $ params , $ this -> signer ) ; return $ this -> parseJsonResult ( $ response [ 'body' ] ) ; }
Get STS session token
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating StsClient instance.
@return object the server response.
Get STS session token