System.Net.IAuthenticationModule Interface

public interface IAuthenticationModule

Assembly

System

Library

Networking

Summary

Implemented by types that perform client authentication.

Description

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:

AuthenticationTypeProtocol
"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
[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 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.

]

See Also

System.Net Namespace

Members

IAuthenticationModule Methods

IAuthenticationModule.Authenticate Method
IAuthenticationModule.PreAuthenticate Method

IAuthenticationModule Properties

IAuthenticationModule.AuthenticationType Property
IAuthenticationModule.CanPreAuthenticate Property


IAuthenticationModule.Authenticate Method

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

Summary

Returns an instance of the Authorization class that provides a response to an authentication challenge.

Parameters

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 .

Return Value

A Authorization instance containing the challenge response, or null if the challenge cannot be handled.

Description

[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 returns null . 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.]

See Also

System.Net.IAuthenticationModule Interface, System.Net Namespace

IAuthenticationModule.PreAuthenticate Method

Authorization PreAuthenticate(WebRequest request, ICredentials credentials);

Summary

Returns an instance of the Authorization class containing client authentication information.

Parameters

request
The WebRequest instance associated with the authentication request.
credentials
The credentials associated with the authentication request.

Return Value

A Authorization instance containing client authentication information to be sent with request, or null if the current instance does not support preauthentication.

Description

[Behaviors: This method returns an instance of the Authorization class containing authentication information to be sent with the request. This method is required to return null 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 .]

See Also

System.Net.IAuthenticationModule Interface, System.Net Namespace

IAuthenticationModule.AuthenticationType Property

string AuthenticationType { get; }

Summary

Gets the authentication type of the current instance.

Property Value

A String indicating the authentication type of the current authentication module.

Description

This property is read-only.

[Behaviors: The following string values are reserved for use by modules implementing the indicated protocols:

AuthenticationTypeProtocol
"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 can also be unregistered by passing the value of this property to the System.Net.AuthenticationManager.Unregister(System.Net.IAuthenticationModule) method.]

See Also

System.Net.IAuthenticationModule Interface, System.Net Namespace

IAuthenticationModule.CanPreAuthenticate Property

bool CanPreAuthenticate { get; }

Summary

Gets a Boolean value indicating whether the authentication module supports preauthentication.

Property Value

true if the authentication module supports preauthentication; otherwise false .

Description

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 returns false 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.]

See Also

System.Net.IAuthenticationModule Interface, System.Net Namespace