Skip to content

Commit

Permalink
IIS7Website - Add support for sslFlags. Thanks thpert
Browse files Browse the repository at this point in the history
  • Loading branch information
mikefourie committed Jul 17, 2014
1 parent 31002ea commit cad0542
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Solutions/Main/IIS7/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,9 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LogDirectory", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#ModifyLogDirectory()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "RapidFailProtection", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7AppPool.#SetCommonInfo()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LoadUserProfile", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7AppPool.#SetCommonInfo()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "BasicAuthentication", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#ProcessApplications()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "WindowsAuthentication", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#ProcessApplications()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "AnonymousAuthentication", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#ProcessApplications()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "DigestAuthentication", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#ProcessApplications()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "SslFlags", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#ProcessApplications()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "MSBuild.ExtensionPack.Web.Iis7Website.#SslFlags")]
21 changes: 17 additions & 4 deletions Solutions/Main/IIS7/IIS7Website.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace MSBuild.ExtensionPack.Web

/// <summary>
/// <b>Valid TaskActions are:</b>
/// <para><i>AddApplication</i> (<b>Required: </b> Name, Applications <b>Optional: </b>Force)</para>
/// <para><i>AddApplication</i> (<b>Required: </b> Name, Applications <b>Optional: AppPool, EnabledProtocols, AnonymousAuthentication, BasicAuthentication, DigestAuthentication, WindowsAuthentication, sslFlags</b>Force)</para>
/// <para><i>AddMimeType</i> (<b>Required: </b> Name, MimeTypes)</para>
/// <para><i>AddResponseHeaders</i> (<b>Required: </b> Name, HttpResponseHeaders)</para>
/// <para><i>AddVirtualDirectory</i> (<b>Required: </b> Name, VirtualDirectories <b>Optional: </b>Force)</para>
Expand Down Expand Up @@ -187,7 +187,12 @@ public class Iis7Website : BaseTask
/// Sets the Enabled Protocols for the website
/// </summary>
public string EnabledProtocols { get; set; }


/// <summary>
/// Sets the SSl Flag for the website
/// </summary>
public string SslFlags { get; set; }

/// <summary>
/// Sets AnonymousAuthentication for the website. Default is true
/// </summary>
Expand All @@ -196,7 +201,7 @@ public bool AnonymousAuthentication
get { return this.anonymousAuthentication; }
set { this.anonymousAuthentication = value; }
}

/// <summary>
/// Sets DigestAuthentication for the website. Default is false;
/// </summary>
Expand Down Expand Up @@ -555,7 +560,15 @@ private void ProcessApplications()
}

this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Setting additional settings for Application: {0}", app.ItemSpec));

// Set the authentification parameters
Configuration config = this.iisServerManager.GetApplicationHostConfiguration();
if (!string.IsNullOrEmpty(this.SslFlags))
{
this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Setting SslFlags for Application: {0} - {1}", app.ItemSpec, this.SslFlags));
ConfigurationSection accessSection = config.GetSection("system.webServer/security/access", this.Name + app.ItemSpec);
accessSection["sslFlags"] = this.SslFlags;
}

if (!string.IsNullOrEmpty(app.GetMetadata("WindowsAuthentication")))
{
Expand Down Expand Up @@ -878,4 +891,4 @@ private bool SiteExists()
return this.website != null;
}
}
}
}

0 comments on commit cad0542

Please sign in to comment.