Class MembershipClaimsTransformation
- Namespace
- Stratara.Identity.AspNetCore.Services
- Assembly
- Stratara.Identity.AspNetCore.dll
Per-request alternative to MembershipClaimsPrincipalFactory<TUser>: an
IClaimsTransformation that resolves the stratara:tenant_id claim from
the membership store on every request instead of stamping it into the issued
cookie or token.
public sealed class MembershipClaimsTransformation : IClaimsTransformation
- Inheritance
-
MembershipClaimsTransformation
- Implements
- Inherited Members
- Extension Methods
Remarks
Choose this mode when a tenant switch must take effect immediately without re-issuing the sign-in (the selection is read live per request), at the cost of a membership-store lookup per request — put caching behind the store when that lookup gets hot. Idempotent: principals that already carry the claim (stamped at issuance or by an earlier transformation run) pass through unchanged, so it composes with the factory mode and with consumer-minted tokens.
Constructors
MembershipClaimsTransformation(ITenantMembershipStore)
Per-request alternative to MembershipClaimsPrincipalFactory<TUser>: an
IClaimsTransformation that resolves the stratara:tenant_id claim from
the membership store on every request instead of stamping it into the issued
cookie or token.
public MembershipClaimsTransformation(ITenantMembershipStore membershipStore)
Parameters
membershipStoreITenantMembershipStoreThe membership store the tenant is resolved from.
Remarks
Choose this mode when a tenant switch must take effect immediately without re-issuing the sign-in (the selection is read live per request), at the cost of a membership-store lookup per request — put caching behind the store when that lookup gets hot. Idempotent: principals that already carry the claim (stamped at issuance or by an earlier transformation run) pass through unchanged, so it composes with the factory mode and with consumer-minted tokens.
Methods
TransformAsync(ClaimsPrincipal)
Provides a central transformation point to change the specified principal. Note: this will be run on each AuthenticateAsync call, so its safer to return a new ClaimsPrincipal if your transformation is not idempotent.
public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe ClaimsPrincipal to transform.
Returns
- Task<ClaimsPrincipal>
The transformed principal.