System.Net.AuthenticationManager Class

public class AuthenticationManager

Base Types

Object
  AuthenticationManager

Assembly

System

Library

Networking

Summary

Manages the authentication modules called during the client authentication process.

Description

The AuthenticationManager class manages authentication modules that are responsible for client authentication. [Note: The AuthenticationManager is called by WebRequest instances to provide information that is sent to servers to authenticate the client. The authentication process may consist of requests to an authentication server separate from the resource server, as well as any other activities required to properly authenticate a client.]

The AuthenticationManager queries registered authentication modules by calling the System.Net.IAuthenticationModule.Authenticate(System.String,System.Net.WebRequest,System.Net.ICredentials) method for each module. The first authentication module that returns a Authorization instance is used to authenticate the request. An authentication module, which can be any object that implements the IAuthenticationModule interface, is registered using the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method. Authentication modules are called in the order in which they are registered.

Applications typically do not access this type directly; it provides authentication services for the WebRequest type.

See Also

System.Net Namespace

Members

AuthenticationManager Methods

AuthenticationManager.Authenticate Method
AuthenticationManager.PreAuthenticate Method
AuthenticationManager.Register Method
AuthenticationManager.Unregister(System.Net.IAuthenticationModule) Method
AuthenticationManager.Unregister(System.String) Method

AuthenticationManager Properties

AuthenticationManager.RegisteredModules Property


AuthenticationManager.Authenticate Method

public static Authorization Authenticate(string challenge, WebRequest request, ICredentials credentials);

Summary

Calls registered authentication modules to find a module that responds to the specified authentication challenge.

Parameters

challenge
A String containing the challenge returned by an Internet host. The content of this string is determined by the authentication protocol(s) used by the server that issued the challenge.
request
The WebRequest that received challenge .
credentials
The ICredentials associated with request. [Note: The System.Net.WebRequest.Credentials property of request is used to supply this argument.]

Return Value

A Authorization instance containing the response from the authentication module, or null if no authentication module responded to the challenge.

Applications do not call this method; it is called by WebRequest instances.

Exceptions

Exception TypeCondition
ArgumentNullExceptionchallenge , request , or credentials is null .

Description

The System.Net.AuthenticationManager.Authenticate(System.String,System.Net.WebRequest,System.Net.ICredentials) method invokes the System.Net.IAuthenticationModule.Authenticate(System.String,System.Net.WebRequest,System.Net.ICredentials) method of each registered authentication module until one of the modules returns a Authorization instance. Authentication modules are called in the order in which they were registered via the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method.

[Note: The System.Net.Authorization.Message property of the object returned by this method contains the client's response to the server challenge contained in challenge . ]

See Also

System.Net.AuthenticationManager Class, System.Net Namespace

AuthenticationManager.PreAuthenticate Method

public static Authorization PreAuthenticate(WebRequest request, ICredentials credentials);

Summary

Attempts to obtain a Authorization instance used to initiate client authentication.

Parameters

request
A WebRequest containing a request for access to a resource.
credentials
The ICredentials associated with request .

Return Value

A Authorization instance if an authentication module can provide authentication information to be sent with request ; otherwise, null . If credentials is null , this method returns null .

Exceptions

Exception TypeCondition
ArgumentNullExceptionrequest is null.

Description

The System.Net.AuthenticationManager.PreAuthenticate(System.Net.WebRequest,System.Net.ICredentials) method invokes the System.Net.IAuthenticationModule.PreAuthenticate(System.Net.WebRequest,System.Net.ICredentials) method of each registered authentication module until one of the modules returns a Authorization instance. Authentication modules are called in the order in which they were registered via the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method.

[Note: The Authorization instance contains the information that will be sent by a client to initiate authentication instead of waiting for the server to request it. Authentication modules that support preauthentication allow clients to improve server efficiency by avoiding extra round trips caused by authentication challenges.]

[Note: If an authorization module supports preauthentication of requests, its System.Net.IAuthenticationModule.CanPreAuthenticate property returns true . Note that preauthentication requires that an authentication of the client has already occurred. The information obtained from the initial authentication is used to provide the System.Net.Authorization.Message that is sent to the server as an authentication header in request .]

See Also

System.Net.AuthenticationManager Class, System.Net Namespace

AuthenticationManager.Register Method

public static void Register(IAuthenticationModule authenticationModule);

Summary

Adds an authentication module to the list of registered authentication modules managed by the authentication manager.

Parameters

authenticationModule
The IAuthenticationModule to register.

Exceptions

Exception TypeCondition
ArgumentNullExceptionauthenticationModule is null .

Description

The System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method adds an authentication module to the end of the list of modules managed by the authentication manager. Each registered module is required to have a unique System.Net.IAuthenticationModule.AuthenticationType. If a module with the same System.Net.IAuthenticationModule.AuthenticationType is already registered, this method removes the registered module, and adds authenticationModule to the end of the list. [Note: Authentication modules are called in the order in which they were added to the list.]

[Note: To remove a module, call one of the System.Net.AuthenticationManager.Unregister(System.Net.IAuthenticationModule) methods.]

See Also

System.Net.AuthenticationManager Class, System.Net Namespace

AuthenticationManager.Unregister(System.Net.IAuthenticationModule) Method

public static void Unregister(IAuthenticationModule authenticationModule);

Summary

Removes the specified authentication module from the list of registered modules.

Parameters

authenticationModule
The IAuthenticationModule module to remove.

Exceptions

Exception TypeCondition
ArgumentNullExceptionauthenticationModule is null .
InvalidOperationExceptionauthenticationModule is not a registered authentication module.

Description

[Note: To add an authentication module to the list of registered modules, call the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method.]

See Also

System.Net.AuthenticationManager Class, System.Net Namespace

AuthenticationManager.Unregister(System.String) Method

public static void Unregister(string authenticationScheme);

Summary

Removes the authentication module with the specified authentication type from the list of registered modules.

Parameters

authenticationScheme
A String containing the authentication type of the module to remove.

Exceptions

Exception TypeCondition
ArgumentNullExceptionauthenticationScheme is null .
InvalidOperationExceptionThere is no registered module with the authenticationScheme authentication type.

Description

The authenticationScheme is required to match the value returned by the System.Net.IAuthenticationModule.AuthenticationType property of a registered authentication module.

[Note: To add an authentication module to the list of registered modules, call the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method.]

See Also

System.Net.AuthenticationManager Class, System.Net Namespace

AuthenticationManager.RegisteredModules Property

public static IEnumerator RegisteredModules { get; }

Summary

Gets a list of registered authentication modules.

Property Value

A IEnumerator that provides access to the list of registered authentication modules.

Description

This property is read-only.

[Note: The System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method adds modules to the list of registered authentication modules, and the System.Net.AuthenticationManager.Unregister(System.Net.IAuthenticationModule) method removes modules from it.]

See Also

System.Net.AuthenticationManager Class, System.Net Namespace