protected function acquireSecurityToken($username, $password)
    {
        $data = $this->prepareSecurityTokenRequest($username, $password, $this->authorityUrl);
        $response = Requests::post(self::$StsUrl,null,$data);

        try {
          $this->processSecurityTokenResponse($response);
        }
        catch (Exception $e) {
            // Try to get the token with a federated authentication.
            $response = $this->acquireSecurityTokenFromFederatedSTS($username, $password);

        }
        return $this->processSecurityTokenResponse($response);
    }
protected function acquireSecurityToken($username, $password)
    {
        $data = $this->prepareSecurityTokenRequest($username, $password, $this->authorityUrl);
        $response = Requests::post(self::$StsUrl,null,$data);

        try {
          $this->processSecurityTokenResponse($response);
        }
        catch (Exception $e) {
            // Try to get the token with a federated authentication.
            $response = $this->acquireSecurityTokenFromFederatedSTS($username, $password);

        }
        return $this->processSecurityTokenResponse($response);
    }
protected function acquireSecurityToken ( $ username , $ password ) { $ data = $ this -> prepareSecurityTokenRequest ( $ username , $ password , $ this -> authorityUrl ) ; $ response = Requests :: post ( self :: $ StsUrl , null , $ data ) ; try { $ this -> processSecurityTokenResponse ( $ response ) ; } catch ( Exception $ e ) { // Try to get the token with a federated authentication. $ response = $ this -> acquireSecurityTokenFromFederatedSTS ( $ username , $ password ) ; } return $ this -> processSecurityTokenResponse ( $ response ) ; }
Acquire the service token from STS

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