/// <summary> /// Creates an audit writer and logs the exception. /// </summary> /// <param name="filterContext">The current filter context to get the user and the action.</param> /// <param name="exception"> The exception. </param> protected void AuditFailure(ActionExecutingContext filterContext, Exception exception) { var audit = this.Audit ?? (this.Audit = this.CreateAudit()); if (audit == null) { return; } filterContext.ArgumentMustNotBeNull("filterContext"); audit.AuthenticationCheckFailed(new AuditInfo <string>(filterContext.RequestContext, exception.Message)); }
/// <summary> /// Creates an audit writer and logs the success. /// </summary> /// <param name="filterContext">The current filter context to get the user and the action.</param> protected void AuditSuccess(ControllerContext filterContext) { var audit = this.Audit ?? (this.Audit = this.CreateAudit()); if (audit == null) { return; } filterContext.ArgumentMustNotBeNull("filterContext"); audit.AuthenticationCheckSucceeded(new AuditInfo <Exception>(filterContext.RequestContext)); }
/// <summary> /// Creates an audit writer and logs the exception. /// </summary> /// <param name="filterContext">The current filter context to get the user and the action.</param> /// <param name="exception"> The exception. </param> protected void AuditFailure(HttpActionContext filterContext, Exception exception) { var audit = this.Audit ?? (this.Audit = this.CreateAudit()); if (audit == null) { return; } filterContext.ArgumentMustNotBeNull("filterContext"); // todo: find the current user name audit.AuthenticationCheckFailed(new AuditInfo <string>("user not known", exception.Message)); }