Exemple #1
0
 public static void AddWindowsAuthToServerConfig(this IISDeploymentParameters parameters)
 {
     parameters.AddServerConfigAction(
         element =>
     {
         element.Descendants("windowsAuthentication")
         .Single()
         .SetAttributeValue("enabled", "true");
     });
 }
 public static void SetAnonymousAuth(this IISDeploymentParameters parameters, bool enabled = true)
 {
     parameters.AddServerConfigAction(
         element =>
     {
         element
         .RequiredElement("system.webServer")
         .RequiredElement("security")
         .RequiredElement("authentication")
         .GetOrAdd("anonymousAuthentication")
         .SetAttributeValue("enabled", enabled);
     });
 }
Exemple #3
0
        public static void AddHttpsToServerConfig(this IISDeploymentParameters parameters)
        {
            parameters.AddServerConfigAction(
                element =>
            {
                element.Descendants("binding")
                .Single()
                .SetAttributeValue("protocol", "https");

                element.Descendants("access")
                .Single()
                .SetAttributeValue("sslFlags", "Ssl, SslNegotiateCert");
            });
        }
        public static void SetBasicAuth(this IISDeploymentParameters parameters, bool enabled = true)
        {
            parameters.EnableModule("BasicAuthenticationModule", "%IIS_BIN%\\authbas.dll");

            parameters.AddServerConfigAction(
                element =>
            {
                element
                .RequiredElement("system.webServer")
                .RequiredElement("security")
                .RequiredElement("authentication")
                .GetOrAdd("basicAuthentication")
                .SetAttributeValue("enabled", enabled);
            });
        }
        public static void SetWindowsAuth(this IISDeploymentParameters parameters, bool enabled = true)
        {
            parameters.EnsureSection("windowsAuthentication", "system.webServer", "security", "windowsAuthentication");
            parameters.EnableModule("WindowsAuthenticationModule", "%IIS_BIN%\\authsspi.dll");

            parameters.AddServerConfigAction(
                element =>
            {
                var windowsAuthentication = element
                                            .RequiredElement("system.webServer")
                                            .RequiredElement("security")
                                            .RequiredElement("authentication")
                                            .GetOrAdd("windowsAuthentication");

                windowsAuthentication.SetAttributeValue("enabled", enabled);
                var providers = windowsAuthentication.GetOrAdd("providers");
                providers.GetOrAdd("add", "value", "Negotiate");
                providers.GetOrAdd("add", "value", "NTLM");
            });
        }