Try our conversational search powered by Generative AI!

Class VirtualRoleAuthorizationSession

Runtime class to check if a principal is part of a virtual role

Inheritance
System.Object
VirtualRoleAuthorizationSession
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Security
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
[ServiceConfiguration(Lifecycle = ServiceInstanceScope.Hybrid)]
public class VirtualRoleAuthorizationSession
Remarks

Implements a cache for lookups that can be disabled per virtual role using the EnableIsInRoleCache.

Since the class is scoped per request or per thread to get session caching it should never be stored in singleton instances

Constructors

VirtualRoleAuthorizationSession(VirtualRoleRepository<VirtualRoleProviderBase>)

Declaration
public VirtualRoleAuthorizationSession(VirtualRoleRepository<VirtualRoleProviderBase> repository)
Parameters
Type Name Description
VirtualRoleRepository<VirtualRoleProviderBase> repository

Methods

IsInVirtualRole(IPrincipal, String, SecurityEntityType, Object)

Determines whether the current principal belongs to the specified virtual role.

Declaration
public virtual bool IsInVirtualRole(IPrincipal principal, string role, SecurityEntityType type, object context)
Parameters
Type Name Description
System.Security.Principal.IPrincipal principal

The principal that will be forwarded to the provider

System.String role

The name of the role for which to check membership.

SecurityEntityType type

The security type of the role you want to check

System.Object context

The context under which the query is being performed

Returns
Type Description
System.Boolean

true if the current principal is a member of the specified role; otherwise, false.