예제 #1
0
        /// <summary>
        /// Creates a service certificate and adds to the remote config
        /// </summary>
        public ServiceCertificate CreateServiceCertificateAndAddRemoteDesktop(string username, string password, ref CscfgFile file)
        {
            var certificate = new ServiceCertificate(username, password);

            certificate.Create();

            var desktop = new RemoteDesktop(certificate)
            {
                Username = username,
                Password = password
            };

            file.NewVersion = ((ICloudConfig)desktop).ChangeConfig(file.NewVersion);
            return(certificate);
        }
        /// <summary>
        /// Generates a service certificate and adds the appropriate text to the <certificates/> tag in the .cscfg file
        /// </summary>
        IHostedServiceActivity IServiceCertificate.GenerateAndAddServiceCertificate(string name)
        {
            ServiceCertificate = new ServiceCertificate(name);
            // we have to also create the certificate!
            ServiceCertificate.Create();

            // add these to the config list we have to implement changes to
            if (EnableSsl)
            {
                CloudConfigChanges.Add(new SslEnablement(ServiceCertificate, SslRoleName));
            }
            if (EnableRemoteDesktop)
            {
                CloudConfigChanges.Add(new RemoteDesktop(ServiceCertificate, RdRoleName)
                {
                    Username = RdUsername,
                    Password = RdPassword
                });
            }

            return(this);
        }