This topic has not yet been rated - Rate this topic

ClientWindowsAuthenticationMembershipProvider Class

Enables Windows authentication with client application services.

System.Object
  System.Configuration.Provider.ProviderBase
    System.Web.Security.MembershipProvider
      System.Web.ClientServices.Providers.ClientWindowsAuthenticationMembershipProvider

Namespace:  System.Web.ClientServices.Providers
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)
public class ClientWindowsAuthenticationMembershipProvider : MembershipProvider

The ClientWindowsAuthenticationMembershipProvider type exposes the following members.

  Name Description
Public method ClientWindowsAuthenticationMembershipProvider Initializes a new instance of the ClientWindowsAuthenticationMembershipProvider class.
Top
  Name Description
Public property ApplicationName This property is not used by this class. (Overrides MembershipProvider.ApplicationName.)
Public property Description Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs). (Inherited from ProviderBase.)
Public property EnablePasswordReset This property is not used by this class. (Overrides MembershipProvider.EnablePasswordReset.)
Public property EnablePasswordRetrieval This property is not used by this class. (Overrides MembershipProvider.EnablePasswordRetrieval.)
Public property MaxInvalidPasswordAttempts This property is not used by this class. (Overrides MembershipProvider.MaxInvalidPasswordAttempts.)
Public property MinRequiredNonAlphanumericCharacters This property is not used by this class. (Overrides MembershipProvider.MinRequiredNonAlphanumericCharacters.)
Public property MinRequiredPasswordLength This property is not used by this class. (Overrides MembershipProvider.MinRequiredPasswordLength.)
Public property Name Gets the friendly name used to refer to the provider during configuration. (Inherited from ProviderBase.)
Public property PasswordAttemptWindow This property is not used by this class. (Overrides MembershipProvider.PasswordAttemptWindow.)
Public property PasswordFormat This property is not used by this class. (Overrides MembershipProvider.PasswordFormat.)
Public property PasswordStrengthRegularExpression This property is not used by this class. (Overrides MembershipProvider.PasswordStrengthRegularExpression.)
Public property RequiresQuestionAndAnswer This property is not used by this class. (Overrides MembershipProvider.RequiresQuestionAndAnswer.)
Public property RequiresUniqueEmail This property is not used by this class. (Overrides MembershipProvider.RequiresUniqueEmail.)
Top
  Name Description
Public method ChangePassword This method is not used by this class. (Overrides MembershipProvider.ChangePassword(String, String, String).)
Public method ChangePasswordQuestionAndAnswer This method is not used by this class. (Overrides MembershipProvider.ChangePasswordQuestionAndAnswer(String, String, String, String).)
Public method CreateUser This method is not used by this class. (Overrides MembershipProvider.CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus).)
Protected method DecryptPassword Decrypts an encrypted password. (Inherited from MembershipProvider.)
Public method DeleteUser This method is not used by this class. (Overrides MembershipProvider.DeleteUser(String, Boolean).)
Protected method EncryptPassword(Byte[]) Encrypts a password. (Inherited from MembershipProvider.)
Protected method EncryptPassword(Byte[], MembershipPasswordCompatibilityMode) Encrypts the specified password using the specified password-compatibility mode. (Inherited from MembershipProvider.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method FindUsersByEmail This method is not used by this class. (Overrides MembershipProvider.FindUsersByEmail(String, Int32, Int32, Int32).)
Public method FindUsersByName This method is not used by this class. (Overrides MembershipProvider.FindUsersByName(String, Int32, Int32, Int32).)
Public method GetAllUsers This method is not used by this class. (Overrides MembershipProvider.GetAllUsers(Int32, Int32, Int32).)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetNumberOfUsersOnline This method is not used by this class. (Overrides MembershipProvider.GetNumberOfUsersOnline().)
Public method GetPassword This method is not used by this class. (Overrides MembershipProvider.GetPassword(String, String).)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetUser(Object, Boolean) This method is not used by this class. (Overrides MembershipProvider.GetUser(Object, Boolean).)
Public method GetUser(String, Boolean) This method is not used by this class. (Overrides MembershipProvider.GetUser(String, Boolean).)
Public method GetUserNameByEmail This method is not used by this class. (Overrides MembershipProvider.GetUserNameByEmail(String).)
Public method Initialize Initializes the provider. (Inherited from ProviderBase.)
Public method Logout Logs out the user.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnValidatingPassword Raises the ValidatingPassword event if an event handler has been defined. (Inherited from MembershipProvider.)
Public method ResetPassword This method is not used by this class. (Overrides MembershipProvider.ResetPassword(String, String).)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method UnlockUser This method is not used by this class. (Overrides MembershipProvider.UnlockUser(String).)
Public method UpdateUser This method is not used by this class. (Overrides MembershipProvider.UpdateUser(MembershipUser).)
Public method ValidateUser Automatically authenticates the current user by using the identity supplied by the operating system. (Overrides MembershipProvider.ValidateUser(String, String).)
Top
  Name Description
Public event ValidatingPassword Occurs when a user is created, a password is changed, or a password is reset. (Inherited from MembershipProvider.)
Top

You can use client application services to validate users by using Windows authentication. To enable Windows authentication, you configure your application to use the ClientWindowsAuthenticationMembershipProvider class. For more information, see How to: Configure Client Application Services.

After configuration, you can validate users by calling the static Membership.ValidateUser method. The Membership.ValidateUser method internally calls the ValidateUser method.

The ClientWindowsAuthenticationMembershipProvider.ValidateUser method automatically authenticates the current user and sets the static Thread.CurrentPrincipal property to a ClientRolePrincipal object that contains the current WindowsIdentity. If a ClientRoleProvider is configured for your application, you can use the ClientRolePrincipal object to retrieve user role information from the roles service.

You can retrieve a reference to the current ClientWindowsAuthenticationMembershipProvider instance through the static Membership.Provider property. You can use the membership provider reference to call the ClientWindowsAuthenticationMembershipProvider.ValidateUser method directly. Additionally, you will need the membership provider reference to call the Logout method, which is not available in the MembershipProvider base class.

The following example code demonstrates how to use this method to authenticate a user by using Windows authentication. In this example, the value of the static Membership.Provider property is cast to a ClientWindowsAuthenticationMembershipProvider instance. This makes sure that a NullReferenceException will be thrown if you accidentally test this code by using another membership provider.


private bool ValidateUsingWindowsAuthentication()
{
    ClientWindowsAuthenticationMembershipProvider authProvider =
        System.Web.Security.Membership.Provider as
        ClientWindowsAuthenticationMembershipProvider;

    // Call ValidateUser and pass null values for the parameters.
    // This call always returns true.
    return authProvider.ValidateUser(null, null);
}


.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ