Retrieve a SAML Token

The vCenter Single Sign-On service provides authentication mechanisms for securing the operations that your client application performs in the virtual environment. Client applications use SAML security tokens for authentication.

Client applications use the vCenter Single Sign-On service to retrieve SAML tokens. For more information about how to acquire a SAML security token, see the vCenter Single Sign-On Programming Guide documentation.

The vSphere Automation SDK for .NET provides the SsoConnection utility class. The utility creates a connection with the vCenter Single Sign-On service and acquires a SAML token. The security token is required for securing the communication between the client application and the services running in your virtual environment. The source file of the utility is in the vSphere Automation SDK for .NET directory: client/samples/src/Samples/vmware/vcloud/suite/samples/common/SsoConnection.cs.

The vSphere Automation SDK for Python provides a utility class to simplify the task of requesting a SAML token from the vCenter Single Sign-On service. The utility provides a wrapper around the complexity of handling token requests. For more information about the utility, see the sso.py sample file. The source file is in the vSphere Automation SDK for Python directory: client/samples/src/com/vmware/vcloud/suite/sample/common/sso.py.

Prerequisites

Verify that you have the vCenter Single Sign-On URL. You can use the Lookup Service on the Platform Services Controller to obtain the endpoint URL. For information about retrieving service endpoints, see Retrieving Service Endpoints.

Procedure

  1. Create a connection object to communicate with the vCenter Single Sign-On service.
    Pass the vCenter Single Sign-On endpoint URL, which you can get from the Lookup Service.
  2. Issue a security token request by sending valid user credentials to the vCenter Single Sign-On service on the Platform Services Controller.

Results

The vCenter Single Sign-On service returns a SAML token.

What to do next

You can present the SAML token to the vSphere Automation API Endpoint or other endpoints, such as the vSphere Web Services Endpoint. The endpoint returns a session ID and establishes a persistent session with that endpoint. Each endpoint that you connect to uses your SAML token to create its own session.