From 27fb3efd4164c5d869d358a62b05d5dfc2a13f6c Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 18 Sep 2017 16:09:27 -0400 Subject: [PATCH] Fixes access log spam --- TGServerService/Administration.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/TGServerService/Administration.cs b/TGServerService/Administration.cs index 844cf61c36..bc9f171782 100644 --- a/TGServerService/Administration.cs +++ b/TGServerService/Administration.cs @@ -11,6 +11,8 @@ namespace TGServerService partial class TGStationServer : ServiceAuthorizationManager, ITGAdministration { SecurityIdentifier TheDroidsWereLookingFor; + object authLock = new object(); + string LastSeenUser = null; /// public string GetCurrentAuthorizedGroup() @@ -73,7 +75,7 @@ namespace TGServerService //This does NOT validate the windows account, that is done when the user connects internally protected override bool CheckAccessCore(OperationContext operationContext) { - if (operationContext.EndpointDispatcher.ContractName == typeof(ITGConnectivity).Name) //always allow connectivity checks + if (operationContext.EndpointDispatcher.ContractName == typeof(ITGConnectivity).Name) //always allow connectivity checks return true; var windowsIdent = operationContext.ServiceSecurityContext.WindowsIdentity; @@ -104,8 +106,14 @@ namespace TGServerService } } } - - TGServerService.WriteAccess(operationContext.ServiceSecurityContext.WindowsIdentity.Name, authSuccess); + lock (authLock) + { + var user = operationContext.ServiceSecurityContext.WindowsIdentity.Name; + if (LastSeenUser != user) { + LastSeenUser = user; + TGServerService.WriteAccess(user, authSuccess); + } + } return authSuccess; }