public IdentitySecurityLog(IGuidGenerator guidGenerator, SecurityLogInfo securityLogInfo) : base(guidGenerator.Create()) { TenantId = securityLogInfo.TenantId; TenantName = securityLogInfo.TenantName.Truncate(IdentitySecurityLogConsts.MaxTenantNameLength); ApplicationName = securityLogInfo.ApplicationName.Truncate(IdentitySecurityLogConsts.MaxApplicationNameLength); Identity = securityLogInfo.Identity.Truncate(IdentitySecurityLogConsts.MaxIdentityLength); Action = securityLogInfo.Action.Truncate(IdentitySecurityLogConsts.MaxActionLength); UserId = securityLogInfo.UserId; UserName = securityLogInfo.UserName.Truncate(IdentitySecurityLogConsts.MaxUserNameLength); CreationTime = securityLogInfo.CreationTime; ClientIpAddress = securityLogInfo.ClientIpAddress.Truncate(IdentitySecurityLogConsts.MaxClientIpAddressLength); ClientId = securityLogInfo.ClientId.Truncate(IdentitySecurityLogConsts.MaxClientIdLength); CorrelationId = securityLogInfo.CorrelationId.Truncate(IdentitySecurityLogConsts.MaxCorrelationIdLength); BrowserInfo = securityLogInfo.BrowserInfo.Truncate(IdentitySecurityLogConsts.MaxBrowserInfoLength); foreach (var property in securityLogInfo.ExtraProperties) { ExtraProperties.Add(property.Key, property.Value); } }
public Task SaveAsync(SecurityLogInfo securityLogInfo) { if (!SecurityLogOptions.IsEnabled) { return(Task.CompletedTask); } Logger.LogInformation(securityLogInfo.ToString()); return(Task.CompletedTask); }
public async Task SaveAsync(SecurityLogInfo securityLogInfo) { if (!SecurityLogOptions.IsEnabled) { return; } using (var uow = UnitOfWorkManager.Begin(requiresNew: true)) { await IdentitySecurityLogRepository.InsertAsync(new IdentitySecurityLog(GuidGenerator, securityLogInfo)); await uow.CompleteAsync(); } }
public IdentitySecurityLog(IGuidGenerator guidGenerator, SecurityLogInfo securityLogInfo) { Id = guidGenerator.Create(); TenantId = securityLogInfo.TenantId; TenantName = securityLogInfo.TenantName.Truncate(IdentitySecurityLogConsts.MaxTenantNameLength); ApplicationName = securityLogInfo.ApplicationName.Truncate(IdentitySecurityLogConsts.MaxApplicationNameLength); Identity = securityLogInfo.Identity.Truncate(IdentitySecurityLogConsts.MaxIdentityLength); Action = securityLogInfo.Action.Truncate(IdentitySecurityLogConsts.MaxActionLength); UserId = securityLogInfo.UserId; UserName = securityLogInfo.UserName.Truncate(IdentitySecurityLogConsts.MaxUserNameLength); CreationTime = securityLogInfo.CreationTime; ClientIpAddress = securityLogInfo.ClientIpAddress.Truncate(IdentitySecurityLogConsts.MaxClientIpAddressLength); ClientId = securityLogInfo.ClientId.Truncate(IdentitySecurityLogConsts.MaxClientIdLength); CorrelationId = securityLogInfo.CorrelationId.Truncate(IdentitySecurityLogConsts.MaxCorrelationIdLength); BrowserInfo = securityLogInfo.BrowserInfo.Truncate(IdentitySecurityLogConsts.MaxBrowserInfoLength); ExtraProperties = securityLogInfo.ExtraProperties; }