protected function acquireSecurityTokenFromFederatedSTS($username, $password) {

        $response = Requests::get(str_replace('{username}', $username, self::$RealmUrlTemplate),null);
        $federatedStsUrl = $this->getFederatedAuthenticationInformation($response);

        if ($federatedStsUrl) {
          $message_id = md5(uniqid($username . '-' . time() . '-' . rand() , true));
          $data = $this->prepareSecurityFederatedTokenRequest($username, $password, $message_id, $federatedStsUrl->textContent);

          $headers = array();
          $headers['Content-Type'] = 'application/soap+xml';
          $response = Requests::post($federatedStsUrl->textContent, $headers, $data);

          $samlAssertion = $this->getSamlAssertion($response);

          if ($samlAssertion) {
            $samlAssertion_node = $samlAssertion->item(0);
            $data = $this->prepareRST2Request($samlAssertion_node);
            $response = Requests::post(self::$RST2Url, $headers, $data);
            $this->usingFederatedSTS = TRUE;

            return $response;
          }
        }

        return NULL;
    }
protected function acquireSecurityTokenFromFederatedSTS($username, $password) {

        $response = Requests::get(str_replace('{username}', $username, self::$RealmUrlTemplate),null);
        $federatedStsUrl = $this->getFederatedAuthenticationInformation($response);

        if ($federatedStsUrl) {
          $message_id = md5(uniqid($username . '-' . time() . '-' . rand() , true));
          $data = $this->prepareSecurityFederatedTokenRequest($username, $password, $message_id, $federatedStsUrl->textContent);

          $headers = array();
          $headers['Content-Type'] = 'application/soap+xml';
          $response = Requests::post($federatedStsUrl->textContent, $headers, $data);

          $samlAssertion = $this->getSamlAssertion($response);

          if ($samlAssertion) {
            $samlAssertion_node = $samlAssertion->item(0);
            $data = $this->prepareRST2Request($samlAssertion_node);
            $response = Requests::post(self::$RST2Url, $headers, $data);
            $this->usingFederatedSTS = TRUE;

            return $response;
          }
        }

        return NULL;
    }
protected function acquireSecurityTokenFromFederatedSTS ( $ username , $ password ) { $ response = Requests :: get ( str_replace ( '{username}' , $ username , self :: $ RealmUrlTemplate ) , null ) ; $ federatedStsUrl = $ this -> getFederatedAuthenticationInformation ( $ response ) ; if ( $ federatedStsUrl ) { $ message_id = md5 ( uniqid ( $ username . '-' . time ( ) . '-' . rand ( ) , true ) ) ; $ data = $ this -> prepareSecurityFederatedTokenRequest ( $ username , $ password , $ message_id , $ federatedStsUrl -> textContent ) ; $ headers = array ( ) ; $ headers [ 'Content-Type' ] = 'application/soap+xml' ; $ response = Requests :: post ( $ federatedStsUrl -> textContent , $ headers , $ data ) ; $ samlAssertion = $ this -> getSamlAssertion ( $ response ) ; if ( $ samlAssertion ) { $ samlAssertion_node = $ samlAssertion -> item ( 0 ) ; $ data = $ this -> prepareRST2Request ( $ samlAssertion_node ) ; $ response = Requests :: post ( self :: $ RST2Url , $ headers , $ data ) ; $ this -> usingFederatedSTS = TRUE ; return $ response ; } } return NULL ; }
Acquire the service token from Federated STS

@param string $username
@param string $password
@return string
Acquire the service token from Federated STS