Class TestClaimsPrincipalFactory

Namespace
XBullet.EasyTesting.Authentication
Assembly
XBullet.EasyTesting.dll

Creates standard claims identities for a transported test user and provides overridable identity materialization for applications with custom ClaimsIdentity types.

public class TestClaimsPrincipalFactory : ITestClaimsPrincipalFactory
Inheritance
TestClaimsPrincipalFactory
Implements
Inherited Members

Methods

CreateAdditionalIdentity(TestIdentity)

Creates an additional identity. Override this to materialize application-specific identity classes such as an application-specific ApiUserIdentity.

protected virtual ClaimsIdentity CreateAdditionalIdentity(TestIdentity identity)

Parameters

identity TestIdentity

The non-null additional-identity definition whose claims, authentication type, name-claim type, and role-claim type are copied. The factory does not retain, own, or mutate it.

Returns

ClaimsIdentity

A new claims identity containing the supplied definition. Ownership passes to the caller, which normally adds it to the returned principal.

CreatePrimaryIdentity(TestUser)

Creates the primary identity represented by the test user.

protected virtual ClaimsIdentity CreatePrimaryIdentity(TestUser user)

Parameters

user TestUser

The non-null transported definition whose name identifier, name, roles, claims, authentication type, and claim-type mappings are copied. The factory does not retain, own, or mutate it.

Returns

ClaimsIdentity

A new claims identity containing the primary user claims. Ownership passes to the caller, which normally adds it to the returned principal.

CreatePrincipal(TestUser)

Creates the claims principal used by the test authentication ticket.

public virtual ClaimsPrincipal CreatePrincipal(TestUser user)

Parameters

user TestUser

The transported test-user definition to materialize. The factory reads but does not own or mutate the definition.

Returns

ClaimsPrincipal

A claims principal representing all identities and claims in user. The caller owns the returned principal.