WindowsTokenRoleProvider WindowsTokenRoleProvider WindowsTokenRoleProvider WindowsTokenRoleProvider Class

Definition

Gets role information for an ASP.NET application from Windows group membership.

public ref class WindowsTokenRoleProvider : System::Web::Security::RoleProvider
public class WindowsTokenRoleProvider : System.Web.Security.RoleProvider
type WindowsTokenRoleProvider = class
    inherit RoleProvider
Public Class WindowsTokenRoleProvider
Inherits RoleProvider
Inheritance
WindowsTokenRoleProviderWindowsTokenRoleProviderWindowsTokenRoleProviderWindowsTokenRoleProvider

Examples

The following example shows the Web.config file for an ASP.NET application. It specifies that the application uses both Windows authentication and the WindowsTokenRoleProvider class to retrieve role information for Windows users. The element specifies that only users in the BUILTIN\Administrators group are allowed access to the application.

<configuration>  
  <system.web>  
    <authentication mode="Windows" />  

    <authorization>  
      <allow roles="BUILTIN\Administrators" />  
        <deny users="*" />  
      </authorization>  

    <roleManager defaultProvider="WindowsProvider"   
      enabled="true"  
      cacheRolesInCookie="false">  
      <providers>  
        <add  
          name="WindowsProvider"  
          type="System.Web.Security.WindowsTokenRoleProvider" />  
      </providers>  
    </roleManager>  

  </system.web>  
</configuration>  

Remarks

The WindowsTokenRoleProvider class is a read-only role-membership provider that retrieves role information for a Windows user based on Windows security groups. It is most useful with ASP.NET applications that use Windows authentication mode where the IIS authentication settings disable anonymous authentication. You can configure ASP.NET applications to allow or deny access based on a user's membership in a particular Windows group.

You cannot use the WindowsTokenRoleProvider class to create or delete roles or modify the membership of a role that is based on Windows group membership. This functionality is managed by the Windows operating system. The WindowsTokenRoleProvider class supports only the IsUserInRole and GetRolesForUser methods of the RoleProvider abstract class.

Constructors

WindowsTokenRoleProvider() WindowsTokenRoleProvider() WindowsTokenRoleProvider() WindowsTokenRoleProvider()

Creates an instance of the WindowsTokenRoleProvider class.

Properties

ApplicationName ApplicationName ApplicationName ApplicationName

Gets or sets the name of the application.

Description Description Description Description

Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).

(Inherited from ProviderBase)
Name Name Name Name

Gets the friendly name used to refer to the provider during configuration.

(Inherited from ProviderBase)

Methods

AddUsersToRoles(String[], String[]) AddUsersToRoles(String[], String[]) AddUsersToRoles(String[], String[]) AddUsersToRoles(String[], String[])

This method is not supported by the Windows token role provider.

CreateRole(String) CreateRole(String) CreateRole(String) CreateRole(String)

This method is not supported by the Windows token role provider.

DeleteRole(String, Boolean) DeleteRole(String, Boolean) DeleteRole(String, Boolean) DeleteRole(String, Boolean)

This method is not supported by the Windows token role provider.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FindUsersInRole(String, String) FindUsersInRole(String, String) FindUsersInRole(String, String) FindUsersInRole(String, String)

This method is not supported by the Windows token role provider.

GetAllRoles() GetAllRoles() GetAllRoles() GetAllRoles()

This method is not supported by the Windows token role provider.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetRolesForUser(String) GetRolesForUser(String) GetRolesForUser(String) GetRolesForUser(String)

Gets a list of the Windows groups that a user is in.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetUsersInRole(String) GetUsersInRole(String) GetUsersInRole(String) GetUsersInRole(String)

This method is not supported by the Windows token role provider.

Initialize(String, NameValueCollection) Initialize(String, NameValueCollection) Initialize(String, NameValueCollection) Initialize(String, NameValueCollection)

Initializes the Windows token role provider with the property values specified in the configuration file for the ASP.NET application. This method is not intended to be used directly from your code.

IsUserInRole(String, String) IsUserInRole(String, String) IsUserInRole(String, String) IsUserInRole(String, String)

Gets a value indicating whether the specified user is in the specified Windows group.

IsUserInRole(String, WindowsBuiltInRole) IsUserInRole(String, WindowsBuiltInRole) IsUserInRole(String, WindowsBuiltInRole) IsUserInRole(String, WindowsBuiltInRole)

Gets a value indicating whether the specified user is in the specified built-in Windows role.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveUsersFromRoles(String[], String[]) RemoveUsersFromRoles(String[], String[]) RemoveUsersFromRoles(String[], String[]) RemoveUsersFromRoles(String[], String[])

This method is not supported by the Windows token role provider.

RoleExists(String) RoleExists(String) RoleExists(String) RoleExists(String)

This method is not supported by the Windows token role provider.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also