System.Net.IAuthenticationModule Interface

Assembly: System.dll
Namespace: System.Net
Summary
Provides the base authentication interface for Web client authentication modules.
C# Syntax:
public interface IAuthenticationModule
Remarks
The IAuthenticationModule interface defines the properties and methods that custom authentication modules must use.

Authentication modules conduct the entire authentication process with a server, responding to an authentication challenge as appropriate. This 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 request for a URI.

Custom authentication modules should implement the IAuthenticationModule interface and then register with the AuthenticationManager.Register method. Authentication modules are also registered at program initialization by reading the configuration file.

See also:
System.Net Namespace | AuthenticationManager

System.Net.IAuthenticationModule Member List:

Public Properties
AuthenticationType Read-only

Gets the authentication type provided by this authentication module.
CanPreAuthenticate Read-only

Gets a value indicating whether the authentication module supports preauthentication.
Public Methods
Authenticate Returns an instance of the Authorization class in respose to an authentication challenge from a server.
PreAuthenticate Returns an instance of the Authorization class for an authentication request to a server.

System.Net.IAuthenticationModule Member Details

Property: AuthenticationType (read-only)
Summary
Gets the authentication type provided by this authentication module.
C# Syntax:
string AuthenticationType {get;}
Remarks
The IAuthenticationModule.AuthenticationType property identifies the authentication type implemented by this authentication module. The IAuthenticationModule.AuthenticationType property is used by the AuthenticationManager.Register method to determine if the authentication module has been registered, and by the AuthenticationManager.Unregister method to remove a registered authentication module.

Return to top


Property: CanPreAuthenticate (read-only)
Summary
Gets a value indicating whether the authentication module supports preauthentication.
C# Syntax:
bool CanPreAuthenticate {get;}
Remarks
The IAuthenticationModule.CanPreAuthenticate property is set to true to indicate that the authentication module can respond with a valid Authorization instance when the IAuthenticationModule.PreAuthenticate method is called.

Notes to implementors: This is typically a fixed value; either the authentication module can preauthenticate, or it cannot.

Return to top


Method: Authenticate(
   string challenge,
   WebRequest request,
   ICredentials credentials
)
Summary
Returns an instance of the Authorization class in respose to an authentication challenge from a server.
C# Syntax:
Authorization Authenticate(
   string challenge,
   WebRequest request,
   ICredentials credentials
);
Parameters:

challenge

The authentication challenge sent by the server.

request

The WebRequest instance associated with the challenge.

credentials

The credentials associated with the challenge.

Return Value:
An Authorization instance containing the authorization message for the request, or null if the challenge cannot be handled.
Remarks
The IAuthenticationModule.Authenticate method conducts the authentication process with the server and returns an Authorization instance to the AuthenticationManager.

Notes to implementors: The AuthenticationManager calls the IAuthenticationModule.Authenticate method on registered authentication modules to determine which module handles the challenge. If the authentication module cannot handle the challenge, the IAuthenticationModule.Authenticate method must return null. If the authentication module encounters an error while conducting the authentication process, IAuthenticationModule.Authenticate must throw an exception.

Return to top


Method: PreAuthenticate(
   WebRequest request,
   ICredentials credentials
)
Summary
Returns an instance of the Authorization class for an authentication request to a server.
C# Syntax:
Authorization PreAuthenticate(
   WebRequest request,
   ICredentials credentials
);
Parameters:

request

The WebRequest instance associated with the authentication request.

credentials

The credentials associated with the authentication request.

Return Value:
An Authorization instance containing the authorization message for the request.
Remarks
When the IAuthenticationModule.CanPreAuthenticate property is true, the IAuthenticationModule.PreAuthenticate method will return an instance of the Authorization class containing an authentication message.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.