AuthenticationManager.RegisteredModules 属性

定义

获取注册到身份验证管理器中的身份验证模块的列表。

public:
 static property System::Collections::IEnumerator ^ RegisteredModules { System::Collections::IEnumerator ^ get(); };
public static System.Collections.IEnumerator RegisteredModules { get; }
static member RegisteredModules : System.Collections.IEnumerator
Public Shared ReadOnly Property RegisteredModules As IEnumerator

属性值

IEnumerator,它启用要被阅读的已注册的身份验证模块。

示例

以下示例使用 RegisteredModules 属性获取向身份验证管理器注册的身份验证模块的列表。 有关完整示例,请参阅 AuthenticationManager 类。

// Display registered authentication modules.
static void displayRegisteredModules()
{
   
   // The AuthenticationManager calls all authentication modules sequentially
   // until one of them responds with an authorization instance.  Show
   // the current registered modules, for testing purposes.
   IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules;
   Console::WriteLine( "\r\nThe following authentication modules are now registered with the system" );
   while ( registeredModules->MoveNext() )
   {
      Console::WriteLine( "\r \n Module : {0}", registeredModules->Current );
      IAuthenticationModule^ currentAuthenticationModule = dynamic_cast<IAuthenticationModule^>(registeredModules->Current);
      Console::WriteLine( "\t  CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate );
   }
}
// Display registered authentication modules.
private static void DisplayRegisteredModules()
{
  // The AuthenticationManager calls all authentication modules sequentially
  // until one of them responds with an authorization instance.  Show
  // the current registered modules.
  IEnumerator registeredModules = AuthenticationManager.RegisteredModules;
  Console.WriteLine("\r\nThe following authentication modules are now registered with the system:");
  while(registeredModules.MoveNext())
  {
    Console.WriteLine("\r \n Module : {0}",registeredModules.Current);
    IAuthenticationModule currentAuthenticationModule = (IAuthenticationModule)registeredModules.Current;
    Console.WriteLine("\t  CanPreAuthenticate : {0}",currentAuthenticationModule.CanPreAuthenticate);
  }
}
' Display registered authentication modules.
Private Shared Sub displayRegisteredModules()
  ' The AuthenticationManager calls all authentication modules sequentially 
  ' until one of them responds with an authorization instance.  Show
  ' the current registered modules.
  Dim registeredModules As IEnumerator = AuthenticationManager.RegisteredModules
  Console.WriteLine(ControlChars.Cr + ControlChars.Lf + "The following authentication modules are now registered with the system:")
  While registeredModules.MoveNext()
    Console.WriteLine(ControlChars.Cr + " " + ControlChars.Lf + " Module : {0}", registeredModules.Current)
    Dim currentAuthenticationModule As IAuthenticationModule = CType(registeredModules.Current, IAuthenticationModule)
    Console.WriteLine(ControlChars.Tab + "  CanPreAuthenticate : {0}", currentAuthenticationModule.CanPreAuthenticate)
  End While
End Sub

注解

属性 RegisteredModules 提供一个 IEnumerator 实例,该实例允许读取已注册的身份验证模块的列表。 方法 Register 将模块添加到列表中,方法 Unregister 从列表中删除模块。

适用于