/// <summary>Removes the specified authentication module from the list of registered modules.</summary>
 /// <param name="authenticationModule">The <see cref="T:System.Net.IAuthenticationModule" /> to remove from the list of registered modules. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="authenticationModule" /> is null. </exception>
 /// <exception cref="T:System.InvalidOperationException">The specified <see cref="T:System.Net.IAuthenticationModule" /> is not registered. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 /// </PermissionSet>
 public static void Unregister(IAuthenticationModule authenticationModule)
 {
     if (authenticationModule == null)
     {
         throw new ArgumentNullException("authenticationModule");
     }
     AuthenticationManager.DoUnregister(authenticationModule.AuthenticationType, true);
 }
 /// <summary>Removes authentication modules with the specified authentication scheme from the list of registered modules.</summary>
 /// <param name="authenticationScheme">The authentication scheme of the module to remove. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="authenticationScheme" /> is null. </exception>
 /// <exception cref="T:System.InvalidOperationException">A module for this authentication scheme is not registered. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 /// </PermissionSet>
 public static void Unregister(string authenticationScheme)
 {
     if (authenticationScheme == null)
     {
         throw new ArgumentNullException("authenticationScheme");
     }
     AuthenticationManager.DoUnregister(authenticationScheme, true);
 }
        /// <summary>Registers an authentication module with the authentication manager.</summary>
        /// <param name="authenticationModule">The <see cref="T:System.Net.IAuthenticationModule" /> to register with the authentication manager. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="authenticationModule" /> is null. </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
        /// </PermissionSet>
        public static void Register(IAuthenticationModule authenticationModule)
        {
            if (authenticationModule == null)
            {
                throw new ArgumentNullException("authenticationModule");
            }
            AuthenticationManager.DoUnregister(authenticationModule.AuthenticationType, false);
            ArrayList obj = AuthenticationManager.modules;

            lock (obj)
            {
                AuthenticationManager.modules.Add(authenticationModule);
            }
        }