RolePrincipal RolePrincipal RolePrincipal RolePrincipal Class

Definition

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

public ref class RolePrincipal : System::Security::Claims::ClaimsPrincipal, System::Runtime::Serialization::ISerializable
public class RolePrincipal : System.Security.Claims.ClaimsPrincipal, System.Runtime.Serialization.ISerializable
type RolePrincipal = class
    inherit ClaimsPrincipal
    interface ISerializable
Public Class RolePrincipal
Inherits ClaimsPrincipal
Implements ISerializable
Inheritance
RolePrincipalRolePrincipalRolePrincipalRolePrincipal
Implements

Remarks

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 CurrentHttpContext.

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.

Constructors

RolePrincipal(IIdentity) RolePrincipal(IIdentity) RolePrincipal(IIdentity) RolePrincipal(IIdentity)

Instantiates a RolePrincipal object for the specified identity.

RolePrincipal(IIdentity, String) RolePrincipal(IIdentity, String) RolePrincipal(IIdentity, String) RolePrincipal(IIdentity, String)

Instantiates a RolePrincipal object for the specified identity with role information from the specified encryptedTicket.

RolePrincipal(SerializationInfo, StreamingContext) RolePrincipal(SerializationInfo, StreamingContext) RolePrincipal(SerializationInfo, StreamingContext) RolePrincipal(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.

RolePrincipal(String, IIdentity) RolePrincipal(String, IIdentity) RolePrincipal(String, IIdentity) RolePrincipal(String, IIdentity)

Instantiates a RolePrincipal object for the specified identity using the specified providerName.

RolePrincipal(String, IIdentity, String) RolePrincipal(String, IIdentity, String) RolePrincipal(String, IIdentity, String) RolePrincipal(String, IIdentity, String)

Instantiates a RolePrincipal object for the specified identity using the specified providerName and role information from the specified encryptedTicket.

Properties

CachedListChanged CachedListChanged CachedListChanged CachedListChanged

Gets a value indicating whether the list of role names cached with the RolePrincipal object has been modified.

CookiePath CookiePath CookiePath CookiePath

Gets the path for the cached role names cookie.

Expired Expired Expired Expired

Gets a value indicating whether the roles cookie has expired.

ExpireDate ExpireDate ExpireDate ExpireDate

Gets the date and time when the roles cookie will expire.

Identity Identity Identity Identity

Gets the security identity for the current HTTP request.

IsRoleListCached IsRoleListCached IsRoleListCached IsRoleListCached

Gets a value indicating whether the list of roles for the user has been cached in a cookie.

IssueDate IssueDate IssueDate IssueDate

Gets the date and time that the roles cookie was issued.

ProviderName ProviderName ProviderName ProviderName

Gets the name of the role provider that stores and retrieves role information for the user.

Version Version Version Version

Gets the version number of the roles cookie.

Methods

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

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo object with the data that is required in order to serialize the target object using the specified streaming context.

GetRoles() GetRoles() GetRoles() GetRoles()

Gets a list of roles that the RolePrincipal is a member of.

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

Gets the Type of the current instance.

(Inherited from Object)
IsInRole(String) IsInRole(String) IsInRole(String) IsInRole(String)

Gets a value indicating whether the user represented by the RolePrincipal is in the specified role.

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

Creates a shallow copy of the current Object.

(Inherited from Object)
SetDirty() SetDirty() SetDirty() SetDirty()

Marks the cached role list as having been changed.

ToEncryptedTicket() ToEncryptedTicket() ToEncryptedTicket() ToEncryptedTicket()

Returns the role information cached with the RolePrincipal object encrypted based on the CookieProtectionValue.

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

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

For a description of this member, see GetObjectData(Object, SerializationInfo, StreamingContext).

Applies to