Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AcsNamespace"/> class.
 /// </summary>
 /// <param name="acsDetails">authenticating service Details name</param>
 public AcsNamespace(UploadCertificateResponse acsDetails)
 {
     this.HostName = acsDetails.GlobalAcsHostName;
     this.Namespace = acsDetails.GlobalAcsNamespace;
     this.ResourceProviderRealm = acsDetails.GlobalAcsRPRealm;
 }
        /// <summary>
        /// Method to generate the credential file content
        /// </summary>
        /// <param name="managementCert">management cert</param>
        /// <param name="acsDetails">ACS details</param>
        /// <param name="channelIntegrityKey">Integrity key</param>
        /// <param name="vault">vault object</param>
        /// <param name="site">site object</param>
        /// <returns>vault credential object</returns>
        private ASRVaultCreds GenerateCredentialObject(X509Certificate2 managementCert, UploadCertificateResponse acsDetails, string channelIntegrityKey, ASRVault vault, Site site)
        {
            string serializedCertifivate = Convert.ToBase64String(managementCert.Export(X509ContentType.Pfx));

            AcsNamespace acsNamespace = new AcsNamespace(acsDetails);

            ASRVaultCreds vaultCreds = new ASRVaultCreds(
                                            vault.SubscriptionId,
                                            vault.Name,
                                            serializedCertifivate,
                                            acsNamespace,
                                            channelIntegrityKey,
                                            vault.CloudServiceName,
                                            site.ID,
                                            site.Name);

            return vaultCreds;
        }