public interface IAuthenticationModule
System
Networking
Implemented by types that perform client authentication.
The IAuthenticationModule interface defines the properties and methods that types are required to implement to handle client authentication. Types that implement this interface are called authentication modules. In addition to implementing this interface, an authentication module implements an authentication protocol, such as the Kerberos protocol. The System.Net.IAuthenticationModule.AuthenticationType property value is a case-insensitive string that typically indicates the protocol implemented by the module. Each authentication module registered with the authentication manager is required to have a unique System.Net.IAuthenticationModule.AuthenticationType . The following string values are reserved for use by modules implementing the indicated protocols:
[Note: Authentication modules are registered with the authentication manager (AuthenticationManager ) by calling the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method. When the authentication manager receives an authentication request, registered authentication modules are given the opportunity to handle the authentication in their System.Net.IAuthenticationModule.Authenticate(System.String,System.Net.WebRequest,System.Net.ICredentials) method. Similarly, when a client wishes to avoid waiting for the server to request authentication, it can request preauthentication information to send with a request. If the System.Net.IAuthenticationModule.CanPreAuthenticate property of a registered module returns
AuthenticationType Protocol "basic"
Basic as defined by IETF RFC 2617 "digest" Digest access as defined by IETF RFC 2617 "kerberos" Kerberos as defined by IETF RFC 1510 true
, it is among the modules that are given the opportunity to provide the preauthentication information via the System.Net.IAuthenticationModule.PreAuthenticate(System.Net.WebRequest,System.Net.ICredentials) method.Not all modules receive all authentication and preauthentication requests. The authentication manager searches for an authentication module by invoking the System.Net.IAuthenticationModule.Authenticate(System.String,System.Net.WebRequest,System.Net.ICredentials) or System.Net.IAuthenticationModule.PreAuthenticate(System.Net.WebRequest,System.Net.ICredentials) method of each registered module in the order in which it was registered. Once a module returns a Authorization instance, indicating that it handles the authentication, the authentication manager terminates the search.
]
System.Net Namespace
IAuthenticationModule Methods
IAuthenticationModule.Authenticate Method
IAuthenticationModule.PreAuthenticate Method
IAuthenticationModule Properties
IAuthenticationModule.AuthenticationType Property
IAuthenticationModule.CanPreAuthenticate Property
Authorization Authenticate(string challenge, WebRequest request, ICredentials credentials);
Returns an instance of the Authorization class that provides a response to an authentication challenge.
- challenge
- A String containing the authentication challenge sent by the server. The content of this string is determined by the authentication protocol(s) used by the server that issued the challenge.
- request
- The WebRequest instance that received challenge .
- credentials
- The credentials of the WebRequest instance that received challenge .
A Authorization instance containing the challenge response, ornull
if the challenge cannot be handled.
[Behaviors: If the authentication module can handle challenge , this method proceeds with the authentication in accordance with the authentication protocol implemented by the current instance and returns a Authorization instance containing the challenge response. If the authentication module cannot handle the challenge, this method returnsnull
. If the authentication module encounters an error while conducting the authentication process, this method can, but is not required to throw an exception.]
[Overrides: Implement this method to receive and optionally handle requests for client authentication from the authentication manager.]
[Usage: The AuthenticationManager class invokes the System.Net.IAuthenticationModule.Authenticate(System.String,System.Net.WebRequest,System.Net.ICredentials) method on registered authentication modules to allow modules to handle a server challenge.]
System.Net.IAuthenticationModule Interface, System.Net Namespace
Authorization PreAuthenticate(WebRequest request, ICredentials credentials);
Returns an instance of the Authorization class containing client authentication information.
- request
- The WebRequest instance associated with the authentication request.
- credentials
- The credentials associated with the authentication request.
A Authorization instance containing client authentication information to be sent with request, ornull
if the current instance does not support preauthentication.
[Behaviors: This method returns an instance of the Authorization class containing authentication information to be sent with the request. This method is required to returnnull
if it cannot handle preauthentication requests from the authentication manager.]
[Overrides: Implement this method if the protocol implemented by the current instance supports preauthentication.]
[Usage: This method is used by the authentication manager to handle requests by clients for authentication information that will be used to preempt a server's request for authentication. This method is not called unless the System.Net.IAuthenticationModule.CanPreAuthenticate property returns
true
.]
System.Net.IAuthenticationModule Interface, System.Net Namespace
string AuthenticationType { get; }
Gets the authentication type of the current instance.
A String indicating the authentication type of the current authentication module.
This property is read-only.[Behaviors: The following string values are reserved for use by modules implementing the indicated protocols:
AuthenticationType Protocol "basic" Basic as defined by IETF RFC 2617 "digest" Digest access as defined by IETF RFC 2617 "kerberos" Kerberos as defined by IETF RFC 1510 ]
[Overrides: Implement this property to return a string that identifies all instances of the current type. The string returned by this property typically indicates the protocol implemented by the current type. For example, an authentication module that implements the Digest protocol would typically return "digest" as its
AuthenticationType
. ][Usage: The System.Net.IAuthenticationModule.AuthenticationType property must be unique for all registered authentication modules. The value of this property is used by the System.Net.AuthenticationManager.Register(System.Net.IAuthenticationModule) method to determine if there is already an authentication module registered for the type. Modules may also be unregistered by passing the value of this property to the System.Net.AuthenticationManager.Unregister(System.Net.IAuthenticationModule) method.]
System.Net.IAuthenticationModule Interface, System.Net Namespace
bool CanPreAuthenticate { get; }
Gets a Boolean value indicating whether the authentication module supports preauthentication.
true
if the authentication module supports preauthentication; otherwisefalse
.
This property is read-only.[Behaviors: The System.Net.IAuthenticationModule.CanPreAuthenticate property is set to
true
to indicate that the authentication module can respond with a Authorization instance when the System.Net.IAuthenticationModule.PreAuthenticate(System.Net.WebRequest,System.Net.ICredentials) method is called. This property returnsfalse
if the protocol implemented by the current authentication module does not support preauthentication.]
[Usage: This method is used by the authentication manager to determine which modules receive requests by clients for authentication information that will be supplied in anticipation of a server's request for authentication. This method controls whether the System.Net.IAuthenticationModule.PreAuthenticate(System.Net.WebRequest,System.Net.ICredentials) method can be called.]
System.Net.IAuthenticationModule Interface, System.Net Namespace