SPWebApplications.UsingKerberos extension method

Some extension methods to identify which WebApps are configured for Kerberos authentication. UsingKerberos(IEnum) will return a list of WebApps. UsingKerberos(Dictionary) will return the specific zones using Kerberos. Useful when looking for IIS bindings, which are exposed through SPIisSettings.ServerBindings
Language:
C#
Keywords:
SharePoint
Code Snippet

using Microsoft.SharePoint.Administration;

public static IEnumerable<SPWebApplication> UsingKerberos(this IEnumerable<SPWebApplication> WebApps)

{
    return WebApps.Where(WebApp => WebApp.IisSettings.UsingKerberos().Any());
}

public static Dictionary<SPUrlZone, SPIisSettings> UsingKerberos(this Dictionary<SPUrlZone, SPIisSettings> IisSettings)

{
    return IisSettings.Where(i => i.Value.AuthenticationMode == System.Web.Configuration.AuthenticationMode.Windows &&
                                 !i.Value.DisableKerberos)
                      .ToDictionary(i => i.Key, i => i.Value);
}


Created 2012-01-25
comments powered by Disqus
Login