Security Policies in a C# Web Services SDK Client
The
LoginByToken
sample creates a custom policy assertion that is derived from the .NET class SecurityPolicyAssertion
. The assertion class gives the .NET framework access to the SAML token and the X509 certificate.The sample performs the following operations to set up the security policy and message handling.
- Sets theServicePointManagerproperties to specify SSL3 and HTTP 100-Continue response handling. 100-Continue response handling supports more efficient communication between the client and vCenter Server. When the client-side .NET framework sends a request to the Server, it sends the request header and waits for a 100-Continue response from the Server. After it receives that response, it sends the request body to the Server.
- Creates anX509Certificate2object, specifies the certificate file, and imports the certificate. The certificate file specification indicates a PKCS #12 format file (Public-Key Cryptography Standards) –PfxCertificateFile. The file contains the client’s private key and public certificate. ThePfxCertificateFilesetting is defined in theapp.configfile in theLoginByTokenproject. The definition specifies the location of the file.
- Creates a custom security assertion to store the SAML token and the certificate. The token and certificate will be included in the policy data for theLoginByTokenrequest.
- Defines a custom output filter that is derived from the .NET classSendSecurityFilter.