Implements a data model auditor.
This implementation audit IDataModel objects only if they implement IIdentifiable.
Is the object implements ISecuredDataModel this implementation verfy audit records and generated security incidents if data tampering is detected.
Initializes a new instance of DefaultDataModelAuditor.
public Void DefaultDataModelAuditor(auditingConnection, logger, currentPrincipal, currentTenantId)
Name | Type | Summary |
---|---|---|
auditingConnection | IDbAccess | An IDbAccess interface for Auditing. |
logger | ILogger | Diagnostics sub-system interface. |
currentPrincipal | ClaimsPrincipal | A ClaimsPrincipal representing the user beeing audited. |
currentTenantId | Int32 | Identification of the current Tenant. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when auditingConnection is null. -or- When logger is null. -or- When currentPrincipal is null. |
An IDbAccess interface for Auditing.
public IDbAccess AuditingConnection { get; }
A ClaimsPrincipal representing the user beeing audited.
public ClaimsPrincipal CurrentPrincipal { get; }
Identification of the current Tenant.
public Int32 CurrentTenantId { get; }
Whether this auditor requires a database transaction.
public Boolean RequiresTransaction { get; }
Writes an audit record to the audit repository.
public Void AfterDataAction(model)
Name | Type | Summary |
---|---|---|
model | IDataModel | An IIdentifiableIDataModel to be auditted. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when model is null. |
SecurityException | Thrown when there are error while generating audit data. |
InvalidOperationException | Thrown when a required fresh data could not be retrieved. |
Prepares the audit process and validates secured models as required.
public Void BeforeDataAction(model)
Name | Type | Summary |
---|---|---|
model | IDataModel | An IIdentifiableIDataModel object to audit. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when model is null. |
SecurityIncidentException | Thrown when a security incident is created. |