Class MembershipAuthorizationProvider
- Namespace
- Stratara.Identity.EntityFrameworkCore
- Assembly
- Stratara.Identity.EntityFrameworkCore.dll
Membership-backed IAuthorizationProvider: a role check passes when the current session's actor holds the role as a tenant-scoped membership role within the session's data-owner tenant. Use this overload for hosts without a global (ASP.NET Identity) role store; hosts that also gate on global platform roles use MembershipAuthorizationProvider<TUser> instead.
public sealed class MembershipAuthorizationProvider : IAuthorizationProvider
- Inheritance
-
MembershipAuthorizationProvider
- Implements
- Inherited Members
- Extension Methods
Remarks
Fail-closed: no ambient session, no membership, a non-active membership, or an unknown role
all evaluate to false. Register it as the provider behind the authorizing mediator
(for example AddAuthorizingMediator<MembershipAuthorizationProvider>()) or via
AddMembershipAuthorization() for hosts that resolve
IAuthorizationProvider directly (such as the authorizing outbox dispatcher).
Constructors
MembershipAuthorizationProvider(ISessionContextProvider, ITenantMembershipStore)
Membership-backed IAuthorizationProvider: a role check passes when the current session's actor holds the role as a tenant-scoped membership role within the session's data-owner tenant. Use this overload for hosts without a global (ASP.NET Identity) role store; hosts that also gate on global platform roles use MembershipAuthorizationProvider<TUser> instead.
public MembershipAuthorizationProvider(ISessionContextProvider sessionContextProvider, ITenantMembershipStore membershipStore)
Parameters
sessionContextProviderISessionContextProviderAccessor for the ambient session (actor + data-owner tenant).
membershipStoreITenantMembershipStoreThe membership store the roles are read from.
Remarks
Fail-closed: no ambient session, no membership, a non-active membership, or an unknown role
all evaluate to false. Register it as the provider behind the authorizing mediator
(for example AddAuthorizingMediator<MembershipAuthorizationProvider>()) or via
AddMembershipAuthorization() for hosts that resolve
IAuthorizationProvider directly (such as the authorizing outbox dispatcher).
Methods
IsInRoleAsync(string, CancellationToken)
Check whether the current caller holds role.
public Task<bool> IsInRoleAsync(string role, CancellationToken cancellationToken = default)
Parameters
rolestringThe role name to check.
cancellationTokenCancellationTokenPropagated by the caller.