AuthenticationManager.Unregister Método

Definição

Remove os módulos de autenticação da lista de módulos registrados.Removes authentication modules from the list of registered modules.

Sobrecargas

Unregister(IAuthenticationModule)

Remove o módulo de autenticação especificado da lista de módulos registrados.Removes the specified authentication module from the list of registered modules.

Unregister(String)

Remove os módulos de autenticação com o esquema de autenticação especificado da lista de módulos registrados.Removes authentication modules with the specified authentication scheme from the list of registered modules.

Unregister(IAuthenticationModule)

Remove o módulo de autenticação especificado da lista de módulos registrados.Removes the specified authentication module from the list of registered modules.

public:
 static void Unregister(System::Net::IAuthenticationModule ^ authenticationModule);
public static void Unregister (System.Net.IAuthenticationModule authenticationModule);
static member Unregister : System.Net.IAuthenticationModule -> unit
Public Shared Sub Unregister (authenticationModule As IAuthenticationModule)

Parâmetros

authenticationModule
IAuthenticationModule

O IAuthenticationModule a ser removido da lista de módulos registrados.The IAuthenticationModule to remove from the list of registered modules.

Exceções

authenticationModule é null.authenticationModule is null.

O IAuthenticationModule especificado não está registrado.The specified IAuthenticationModule is not registered.

Exemplos

O exemplo a seguir usa o Unregister método para remover o módulo de autenticação especificado da lista de módulos registrados.The following example uses the Unregister method to remove the specified authentication module from the list of registered modules. Para obter um exemplo completo, consulte a AuthenticationManager classe.For a complete example, refer to the AuthenticationManager class.

// This is the program entry point. It allows the user to enter 
// her credentials and the Internet resource (Web page) to access.
// It also unregisters the standard and registers the customized basic 
// authentication.
static void Main()
{
   array<String^>^args = Environment::GetCommandLineArgs();
   if ( args->Length < 4 )
         showusage();
   else
   {
      
      // Read the user's credentials.
      uri = args[ 1 ];
      username = args[ 2 ];
      password = args[ 3 ];
      if ( args->Length == 4 )
               domain = String::Empty; // If the domain exists, store it. Usually the domain name
      else
               domain = args[ 4 ];

      
      // is by default the name of the server hosting the Internet
      // resource.
      // Unregister the standard Basic authentication module.
      AuthenticationManager::Unregister( "Basic" );
      
      // Instantiate the custom Basic authentication module.
      CustomBasic^ customBasicModule = gcnew CustomBasic;
      
      // Register the custom Basic authentication module.
      AuthenticationManager::Register( customBasicModule );
      
      // Display registered Authorization modules.
      displayRegisteredModules();
      
      // Read the specified page and display it on the console.
      getPage( uri );
   }

   return;
}

// This is the program entry point. It allows the user to enter
// her credentials and the Internet resource (Web page) to access.
// It also unregisters the standard and registers the customized basic
// authentication.
public static void Main(string[] args)
{

  if (args.Length < 3)
        {
            showusage();
        }
        else
  {

    // Read the user's credentials.
    uri = args[0];
    username = args[1];
    password = args[2];

    if (args.Length == 3)
      domain = string.Empty;
    else
      // If the domain exists, store it. Usually the domain name
      // is by default the name of the server hosting the Internet
      // resource.
      domain = args[3];

    // Unregister the standard Basic authentication module.
    AuthenticationManager.Unregister("Basic");

    // Instantiate the custom Basic authentication module.
    CustomBasic customBasicModule = new CustomBasic();

    // Register the custom Basic authentication module.
    AuthenticationManager.Register(customBasicModule);

    // Display registered Authorization modules.
    displayRegisteredModules();

    // Read the specified page and display it on the console.
    getPage(uri);
  }
  return;
}
   ' This is the program entry point. It allows the user to enter 
   ' her credentials and the Internet resource (Web page) to access.
   ' It also unregisters the standard and registers the customized basic 
   ' authentication.
  Private Overloads Shared Sub Main(ByVal args() As String)

    If args.Length < 4 Then
      showusage()
    Else

      ' Read the user's credentials.
      uri = args(1)
      username = args(2)
      password = args(3)

      If args.Length = 4 Then
        domain = String.Empty
        ' If the domain exists, store it. Usually the domain name
        ' is by default the name of the server hosting the Internet
        ' resource.
      Else
        domain = args(5)
      End If
      ' Unregister the standard Basic authentication module.
      AuthenticationManager.Unregister("Basic")

      ' Instantiate the custom Basic authentication module.
      Dim customBasicModule As New CustomBasic()

      ' Register the custom Basic authentication module.
      AuthenticationManager.Register(customBasicModule)

      ' Display registered Authorization modules.
      displayRegisteredModules()

      ' Read the specified page and display it on the console.
      getPage(uri)
    End If
    Return
  End Sub
End Class

Comentários

O Unregister método remove o módulo de autenticação especificado da lista de módulos de autenticação chamados pelo Authenticate método.The Unregister method removes the specified authentication module from the list of authentication modules called by the Authenticate method. O módulo deve ter sido adicionado à lista usando o Register método antes que possa ser removido da lista.The module must have been added to the list using the Register method before it can be removed from the list.

Aplica-se a

Unregister(String)

Remove os módulos de autenticação com o esquema de autenticação especificado da lista de módulos registrados.Removes authentication modules with the specified authentication scheme from the list of registered modules.

public:
 static void Unregister(System::String ^ authenticationScheme);
public static void Unregister (string authenticationScheme);
static member Unregister : string -> unit
Public Shared Sub Unregister (authenticationScheme As String)

Parâmetros

authenticationScheme
String

O esquema de autenticação do módulo a ser removido.The authentication scheme of the module to remove.

Exceções

authenticationScheme é null.authenticationScheme is null.

Um módulo registado para este esquema de autenticação não está registrado.A module for this authentication scheme is not registered.

Exemplos

O exemplo a seguir usa o Unregister método para remover um módulo de autenticação com o esquema de autenticação especificado da lista de módulos registrados.The following example uses the Unregister method to remove an authentication module with the specified authentication scheme from the list of registered modules.

IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules;
// Display all the modules that are already registered with the system.
DisplayAllModules();
registeredModules->Reset();
registeredModules->MoveNext();
// Get the first Authentication module registered with the system.
IAuthenticationModule^ authenticationModule1 = dynamic_cast<IAuthenticationModule^>(registeredModules->Current);
// Call the UnRegister() method to unregister the first authentication module from the system.
String^ authenticationScheme = authenticationModule1->AuthenticationType;
AuthenticationManager::Unregister( authenticationScheme );
Console::WriteLine(  "\nSuccessfully unregistered '{0}'.", authenticationModule1 );
// Display all modules to see that the module was unregistered.
DisplayAllModules();
IEnumerator registeredModules = AuthenticationManager.RegisteredModules;
// Display all the modules that are already registered with the system.
DisplayAllModules();
registeredModules.Reset();
registeredModules.MoveNext();
// Get the first Authentication module registered with the system.
IAuthenticationModule authenticationModule1 = (IAuthenticationModule)registeredModules.Current;
// Call the UnRegister() method to unregister the first authentication module from the system.
String authenticationScheme = authenticationModule1.AuthenticationType;
AuthenticationManager.Unregister(authenticationScheme);
Console.WriteLine("\nSuccessfully unregistered '{0}",authenticationModule1+"'.");
// Display all modules to see that the module was unregistered.
DisplayAllModules();
Dim registeredModules As IEnumerator = AuthenticationManager.RegisteredModules
DisplayAllModules()

registeredModules.Reset()
registeredModules.MoveNext()

'Get the first Authentication module registered with the system
Dim authenticationModule1 As IAuthenticationModule = CType(registeredModules.Current, IAuthenticationModule)

'Call the UnRegister method to unregister the first authentication module from the system.
Dim authenticationScheme As [String] = authenticationModule1.AuthenticationType
AuthenticationManager.Unregister(authenticationScheme)
Console.WriteLine(ControlChars.Cr + "Successfully unregistered {0}", authenticationModule1)
'Display all modules to see that the module was unregistered.
DisplayAllModules()
'Call the Register method to register authenticationModule1 module again.
AuthenticationManager.Register(authenticationModule1)
Console.WriteLine(ControlChars.Cr + "Successfully re-registered {0}", authenticationModule1)
'Display the modules to verify that 'authenticationModule1' has been registered again.
DisplayAllModules()

Comentários

O Unregister método remove o módulo de autenticação com o esquema de autenticação especificado da lista de módulos de autenticação chamados pelo Authenticate método.The Unregister method removes the authentication module with the specified authentication scheme from the list of authentication modules called by the Authenticate method. O módulo deve ter sido adicionado à lista usando o Register método antes que possa ser removido da lista.The module must have been added to the list using the Register method before it can be removed from the list.

Aplica-se a