다음을 통해 공유


AuthenticationManager.Unregister 메서드

정의

등록된 모듈 목록에서 인증 모듈을 제거합니다.

오버로드

Unregister(IAuthenticationModule)

등록된 모듈 목록에서 지정된 인증 모듈을 제거합니다.

Unregister(String)

등록된 모듈 목록에서 지정된 인증 체계가 포함된 인증 모듈을 제거합니다.

Unregister(IAuthenticationModule)

Source:
AuthenticationManager.cs
Source:
AuthenticationManager.cs
Source:
AuthenticationManager.cs

등록된 모듈 목록에서 지정된 인증 모듈을 제거합니다.

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)

매개 변수

authenticationModule
IAuthenticationModule

등록된 모듈 목록에서 제거할 IAuthenticationModule입니다.

예외

authenticationModule이(가) null인 경우

지정된 IAuthenticationModule이 등록되지 않은 경우

예제

다음 예제에서는 메서드를 Unregister 사용하여 등록된 모듈 목록에서 지정된 인증 모듈을 제거합니다. 전체 예제는 클래스를 참조하세요 AuthenticationManager .

// 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

설명

메서드는 Unregister 메서드에서 호출하는 인증 모듈 목록에서 지정된 인증 모듈을 Authenticate 제거합니다. 모듈을 목록에서 제거하려면 먼저 메서드를 Register 사용하여 목록에 추가되어야 합니다.

적용 대상

Unregister(String)

Source:
AuthenticationManager.cs
Source:
AuthenticationManager.cs
Source:
AuthenticationManager.cs

등록된 모듈 목록에서 지정된 인증 체계가 포함된 인증 모듈을 제거합니다.

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)

매개 변수

authenticationScheme
String

제거할 모듈의 인증 체계입니다.

예외

authenticationScheme이(가) null인 경우

이 인증 체계 모듈이 등록되지 않은 경우

예제

다음 예제에서는 메서드를 Unregister 사용하여 등록된 모듈 목록에서 지정된 인증 체계를 사용하여 인증 모듈을 제거합니다.

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()

설명

메서드는 Unregister 메서드에서 호출한 인증 모듈 목록에서 지정된 인증 체계를 사용하여 인증 모듈을 Authenticate 제거합니다. 모듈을 목록에서 제거하려면 먼저 메서드를 Register 사용하여 목록에 추가되어야 합니다.

적용 대상