This example is based on the code in the connection_workflow.py sample file. The source file is located in the following vCloud Suite SDK for Python directory: client/samples/src/com/vmware/vcloud/suite/sample/workflow/connection_workflow.py.

This example uses the steps that are described in the Retrieve a SAML Token procedure.

from com.vmware.vcloud.suite.sample.common import sso

...

# Use the SsoAuthenticator utility class to retrieve
# a bearer SAML token from the vCenter Single Sign-On service. 
authenticator = sso.SsoAuthenticator(sso_url)
saml_token = authenticator.get_bearer_saml_assertion(sso_username,
                                                     sso_password,
                                                     delegatable=True)