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

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.

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.