Python Example of Retrieving a SAML Token

This example is based on the code in the
external_psc_sso_workflow.py
sample file.
This example uses the steps that are described in the Retrieve a SAML Token procedure.
This example uses the following global variables.
  • my_vapi_hostname
  • my_sso_username
  • my_sso_password
For a complete and up-to-date version of the sample code, see the vSphere Automation SDK Python samples at GitHub.
from vsphere.samples.common import sso # Use the SsoAuthenticator utility class to retrieve # a bearer SAML token from the vCenter Single Sign-On service. sso_url = 'https://' + my_vapi_hostname + ':7444/ims/STSService' authenticator = sso.SsoAuthenticator(sso_url) saml_token = authenticator.get_bearer_saml_assertion(my_sso_username, my_sso_password, delegatable=True)