Export (0) Print
Expand All

RolePrincipal Class

Represents security information for the current HTTP request, including role membership. This class cannot be inherited.

Namespace:  System.Web.Security
Assembly:  System.Web (in System.Web.dll)

'Declaration
<SerializableAttribute> _
Public Class RolePrincipal _
	Inherits ClaimsPrincipal _
	Implements ISerializable

The RolePrincipal type exposes the following members.

  NameDescription
Public methodRolePrincipal(IIdentity)Instantiates a RolePrincipal object for the specified identity.
Public methodRolePrincipal(IIdentity, String)Instantiates a RolePrincipal object for the specified identity with role information from the specified encryptedTicket.
Protected methodRolePrincipal(SerializationInfo, StreamingContext)Initializes a new instance of the RolePrincipal class using information that is contained in the specified SerializationInfo object and using the specified streaming context.
Public methodRolePrincipal(String, IIdentity)Instantiates a RolePrincipal object for the specified identity using the specified providerName.
Public methodRolePrincipal(String, IIdentity, String)Instantiates a RolePrincipal object for the specified identity using the specified providerName and role information from the specified encryptedTicket.
Top

  NameDescription
Public propertyCachedListChangedGets a value indicating whether the list of role names cached with the RolePrincipal object has been modified.
Public propertyClaimsGets a collection that contains all of the claims from all of the claims identities associated with this claims principal. (Inherited from ClaimsPrincipal.)
Public propertyCookiePathGets the path for the cached role names cookie.
Public propertyExpiredGets a value indicating whether the roles cookie has expired.
Public propertyExpireDateGets the date and time when the roles cookie will expire.
Public propertyIdentitiesGets a collection that contains all of the claims identities associated with this claims principal. (Inherited from ClaimsPrincipal.)
Public propertyIdentityGets the security identity for the current HTTP request. (Overrides ClaimsPrincipal.Identity.)
Public propertyIsRoleListCachedGets a value indicating whether the list of roles for the user has been cached in a cookie.
Public propertyIssueDateGets the date and time that the roles cookie was issued.
Public propertyProviderNameGets the name of the role provider that stores and retrieves role information for the user.
Public propertyVersionGets the version number of the roles cookie.
Top

  NameDescription
Public methodAddIdentitiesAdds the specified claims identities to this claims principal. (Inherited from ClaimsPrincipal.)
Public methodAddIdentityAdds the specified claims identity to this claims principal. (Inherited from ClaimsPrincipal.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFindAll(Predicate(Of Claim))Retrieves all of the claims that are matched by the specified predicate. (Inherited from ClaimsPrincipal.)
Public methodFindAll(String)Retrieves all or the claims that have the specified claim type. (Inherited from ClaimsPrincipal.)
Public methodFindFirst(Predicate(Of Claim))Retrieves the first claim that is matched by the specified predicate. (Inherited from ClaimsPrincipal.)
Public methodFindFirst(String)Retrieves the first claim with the specified claim type. (Inherited from ClaimsPrincipal.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Protected methodGetObjectDataPopulates a SerializationInfo object with the data that is required in order to serialize the target object using the specified streaming context. (Overrides ClaimsPrincipal.GetObjectData(SerializationInfo, StreamingContext).)
Public methodGetRolesGets a list of roles that the RolePrincipal is a member of.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodHasClaim(Predicate(Of Claim))Determines whether any of the claims identities associated with this claims principal contains a claim that is matched by the specified predicate. (Inherited from ClaimsPrincipal.)
Public methodHasClaim(String, String)Determines whether any of the claims identities associated with this claims principal contains a claim with the specified claim type and value. (Inherited from ClaimsPrincipal.)
Public methodIsInRoleGets a value indicating whether the user represented by the RolePrincipal is in the specified role. (Overrides ClaimsPrincipal.IsInRole(String).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetDirtyMarks the cached role list as having been changed.
Public methodToEncryptedTicketReturns the role information cached with the RolePrincipal object encrypted based on the CookieProtectionValue.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate methodISerializable.GetObjectDataFor a description of this member, see GetObjectData.
Top

The RolePrincipal object implements the IPrincipal interface and represents the current security context for the HTTP request.

When role management is enabled (see Roles), the RoleManagerModule assigns a RolePrincipal object to the User property of the Current HttpContext.

The RolePrincipal class exposes the security identity for the current HTTP request and additionally performs checks for role membership. If CacheRolesInCookie is true, then the RolePrincipal object manages the cached list of roles and looks up role membership for the current user in the cached list first, then the role Provider. If CacheRolesInCookie is false, the RolePrincipal object always looks up role membership using the role provider.

The RolePrincipal object encrypts and decrypts role information cached in the cookie identified by the CookieName based on the CookieProtectionValue.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Show:
© 2014 Microsoft