Muokkaa

Jaa


RolePrincipal Class

Definition

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

public ref class RolePrincipal : System::Runtime::Serialization::ISerializable, System::Security::Principal::IPrincipal
public ref class RolePrincipal : System::Security::Claims::ClaimsPrincipal, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class RolePrincipal : System.Runtime.Serialization.ISerializable, System.Security.Principal.IPrincipal
[System.Serializable]
public class RolePrincipal : System.Security.Claims.ClaimsPrincipal, System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type RolePrincipal = class
    interface IPrincipal
    interface ISerializable
[<System.Serializable>]
type RolePrincipal = class
    inherit ClaimsPrincipal
    interface ISerializable
Public Class RolePrincipal
Implements IPrincipal, ISerializable
Public Class RolePrincipal
Inherits ClaimsPrincipal
Implements ISerializable
Inheritance
RolePrincipal
Inheritance
RolePrincipal
Attributes
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, String)

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

RolePrincipal(IIdentity)

Instantiates a RolePrincipal object for the specified identity.

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, String)

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

RolePrincipal(String, IIdentity)

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

Properties

CachedListChanged

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

Claims

Gets a collection that contains all of the claims from all of the claims identities associated with this claims principal.

(Inherited from ClaimsPrincipal)
CookiePath

Gets the path for the cached role names cookie.

CustomSerializationData

Contains any additional data provided by a derived type. Typically set when calling WriteTo(BinaryWriter, Byte[]).

(Inherited from ClaimsPrincipal)
Expired

Gets a value indicating whether the roles cookie has expired.

ExpireDate

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

Identities

Gets a collection that contains all of the claims identities associated with this claims principal.

(Inherited from ClaimsPrincipal)
Identity

Gets the security identity for the current HTTP request.

IsRoleListCached

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

IssueDate

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

ProviderName

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

Version

Gets the version number of the roles cookie.

Methods

AddIdentities(IEnumerable<ClaimsIdentity>)

Adds the specified claims identities to this claims principal.

(Inherited from ClaimsPrincipal)
AddIdentity(ClaimsIdentity)

Adds the specified claims identity to this claims principal.

(Inherited from ClaimsPrincipal)
Clone()

Returns a copy of this instance.

(Inherited from ClaimsPrincipal)
CreateClaimsIdentity(BinaryReader)

Creates a new claims identity.

(Inherited from ClaimsPrincipal)
Equals(Object)

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

(Inherited from Object)
FindAll(Predicate<Claim>)

Retrieves all of the claims that are matched by the specified predicate.

(Inherited from ClaimsPrincipal)
FindAll(String)

Retrieves all or the claims that have the specified claim type.

(Inherited from ClaimsPrincipal)
FindFirst(Predicate<Claim>)

Retrieves the first claim that is matched by the specified predicate.

(Inherited from ClaimsPrincipal)
FindFirst(String)

Retrieves the first claim with the specified claim type.

(Inherited from ClaimsPrincipal)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
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()

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

GetType()

Gets the Type of the current instance.

(Inherited from Object)
HasClaim(Predicate<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)
HasClaim(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)
IsInRole(String)

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

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SetDirty()

Marks the cached role list as having been changed.

ToEncryptedTicket()

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

ToString()

Returns a string that represents the current object.

(Inherited from Object)
WriteTo(BinaryWriter, Byte[])

Serializes using a BinaryWriter.

(Inherited from ClaimsPrincipal)
WriteTo(BinaryWriter)

Serializes using a BinaryWriter.

(Inherited from ClaimsPrincipal)

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

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

Applies to

See also