Table of Contents

Class AuthAuditEntries

Namespace
Tharga.Team.Service.Audit
Assembly
Tharga.Team.Service.dll

Audit entries for the two events that happen outside any service call: an interactive sign-in, and the user record created as a side effect of a first one.

public static class AuthAuditEntries
Inheritance
AuthAuditEntries
Inherited Members

Remarks

Why these were missing. Every other audited action passes through a service the auditing decorators wrap. These two do not: a sign-in completes inside the authentication handshake, and a first-sign-in user record is created while resolving the caller. So the audit log could say what someone did but never that they arrived — and Tharga.Team.Support could not route the two events Tharga/Team#142 names first, "user logs on" and "user created", because neither existed to route.

Built here rather than at the call sites so the shape is defined once and both are testable without an authentication pipeline.

Fields

Feature

Feature name both entries carry, matching the API-key handler's auth.

public const string Feature = "auth"

Field Value

string

SignInAction

public const string SignInAction = "signin"

Field Value

string

UserCreatedAction

public const string UserCreatedAction = "user-created"

Field Value

string

UserProfileRefreshedAction

public const string UserProfileRefreshedAction = "user-profile-refreshed"

Field Value

string

Methods

SignIn(ClaimsPrincipal)

An interactive sign-in completing.

public static AuditEntry SignIn(ClaimsPrincipal principal)

Parameters

principal ClaimsPrincipal

Returns

AuditEntry

Remarks

User and Web — the counterpart to the API-key handler's auth/apikey entry, which is ApiKey. No team: sign-in precedes team selection, so naming one here would be an invention.

SignIn(ClaimsPrincipal, UserIdentityResolver)

An interactive sign-in completing, with the subject read by the host's identity resolver.

public static AuditEntry SignIn(ClaimsPrincipal principal, UserIdentityResolver identityResolver)

Parameters

principal ClaimsPrincipal
identityResolver UserIdentityResolver

Returns

AuditEntry

UserCreated(IUser, ClaimsPrincipal)

A user record created because someone signed in for the first time.

public static AuditEntry UserCreated(IUser user, ClaimsPrincipal principal)

Parameters

user IUser
principal ClaimsPrincipal

Returns

AuditEntry

Remarks

DataChange rather than an auth event: the sign-in is reported separately, and this is a write. The actor is the new user themselves — nobody else asked for it, which is what distinguishes it from an administrator creating a user through IUserManagementService.

UserCreated(IUser, ClaimsPrincipal, UserIdentityResolver)

A first-sign-in user record, with the subject read by the host's identity resolver.

public static AuditEntry UserCreated(IUser user, ClaimsPrincipal principal, UserIdentityResolver identityResolver)

Parameters

user IUser
principal ClaimsPrincipal
identityResolver UserIdentityResolver

Returns

AuditEntry

UserProfileRefreshed(IUser, string, string, ClaimsPrincipal)

A stored user's name and/or email refreshed from a sign-in the host trusts (UserServiceBase.ShouldRefreshProfile). name or email is null when that value was left unchanged.

public static AuditEntry UserProfileRefreshed(IUser user, string name, string email, ClaimsPrincipal principal)

Parameters

user IUser
name string
email string
principal ClaimsPrincipal

Returns

AuditEntry

Remarks

DataChange with the user as their own actor, like UserCreated(IUser, ClaimsPrincipal). The metadata names which values changed and the address the user now has; the name itself is not copied into the log.

UserProfileRefreshed(IUser, string, string, ClaimsPrincipal, UserIdentityResolver)

A refreshed profile, with the subject read by the host's identity resolver.

public static AuditEntry UserProfileRefreshed(IUser user, string name, string email, ClaimsPrincipal principal, UserIdentityResolver identityResolver)

Parameters

user IUser
name string
email string
principal ClaimsPrincipal
identityResolver UserIdentityResolver

Returns

AuditEntry