Class AuditManager<TAudit>
Provides the APIs for auditing various identity related events (sign-in, create user, change password).
Inherited Members
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class AuditManager<TAudit>
where TAudit : IIdentityAudit
Type Parameters
TAudit
The type encapsulating an audit. |
Constructors
AuditManager(IAuditStore<TAudit>, IHttpContextAccessor, ILogger<AuditManager<TAudit>>, IPAddressLocationManager)
Constructs a new instance of AuditManager<TAudit>.
Declaration
public AuditManager(IAuditStore<TAudit> store, IHttpContextAccessor contextAccessor, ILogger<AuditManager<TAudit>> logger, IPAddressLocationManager ipAddressLocationManager = null)
Parameters
IAuditStore<TAudit>
store
The persistence store the manager will operate over. |
Microsoft.AspNetCore.Http.IHttpContextAccessor
contextAccessor
The accessor used to access the Microsoft.AspNetCore.Http.HttpContext. |
Microsoft.Extensions.Logging.ILogger<AuditManager<TAudit>>
logger
The logger used to log messages, warnings and errors. |
IPAddressLocationManager
ipAddressLocationManager
An IPAddressLocationManager used to get a location for an IPAddress, if any is configured. |
Methods
ClearAuditsAsync(TimeSpan, CancellationToken)
Clears all audits (for all users) created before the provided maxAge
.
Declaration
public Task ClearAuditsAsync(TimeSpan maxAge, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TimeSpan
maxAge
The max age of the audit posts to keep. |
System.Threading.CancellationToken
cancellationToken
The IRM.AspNetCore.Identity.AuditManager`1.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task
The System.Threading.Tasks.Task that represents the asynchronous operation. |
CreateAsync(TAudit)
Declaration
public async Task CreateAsync(TAudit audit)
Parameters
TAudit
audit
|
Returns
System.Threading.Tasks.Task
|
DeleteUserAuditsAsync(Guid)
Declaration
public Task<IdentityResult> DeleteUserAuditsAsync(Guid userId)
Parameters
System.Guid
userId
|
Returns
System.Threading.Tasks.Task<IdentityResult>
|
Dispose()
Releases all resources used by the audit manager.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the role manager and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Boolean
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Finalize()
Declaration
protected void Finalize()
GetUserAuditsAsync(IdQuery)
Returns a list of audits for the specified user id.
Declaration
public Task<QueryResult<TAudit>> GetUserAuditsAsync(IdQuery query)
Parameters
IdQuery
query
The IdQuery object representing the user id and pageing information. |
Returns
System.Threading.Tasks.Task<QueryResult<TAudit>>
The System.Threading.Tasks.Task that represents the asynchronous operation, a QueryResult<T> with a collection of |
ThrowIfDisposed()
Throws System.ObjectDisposedException if this class is disposed.
Declaration
protected void ThrowIfDisposed()