AuthenticationManager.Register(IAuthenticationModule) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
인증 관리자에 인증 모듈을 등록합니다.
public:
static void Register(System::Net::IAuthenticationModule ^ authenticationModule);
public static void Register(System.Net.IAuthenticationModule authenticationModule);
static member Register : System.Net.IAuthenticationModule -> unit
Public Shared Sub Register (authenticationModule As IAuthenticationModule)
매개 변수
- authenticationModule
- IAuthenticationModule
IAuthenticationModule 인증 관리자에 등록할 수 있습니다.
예외
authenticationModule은 null입니다.
예제
다음 예제에서는 인증 관리자에 인증 모듈을 등록합니다. 전체 예제는 클래스를 참조하세요 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.
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
설명
이 메서드는 Register 메서드에서 호출하는 모듈 목록의 끝에 인증 모듈을 Authenticate 추가합니다. 인증 모듈은 목록에 추가된 순서대로 호출됩니다. 동일한 AuthenticationType 모듈이 이미 등록된 경우 이 메서드는 등록된 모듈을 제거하고 목록 끝에 추가합니다 authenticationModule .