 c98e2b2dd6
			
		
	
	c98e2b2dd6
	
	
	
		
			
			* add base grpc service and swap auth service to streaming * remove Authorize from hub itself * remove unused usings * heave files server to net 7, add exception handling in grpc auth stream Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			617 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			617 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Threading;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace MareSynchronosServices.Authentication;
 | |
| 
 | |
| internal class FailedAuthorization : IDisposable
 | |
| {
 | |
|     private int failedAttempts = 1;
 | |
|     public int FailedAttempts => failedAttempts;
 | |
|     public Task ResetTask { get; set; }
 | |
|     public CancellationTokenSource? ResetCts { get; set; }
 | |
| 
 | |
|     public void Dispose()
 | |
|     {
 | |
|         try
 | |
|         {
 | |
|             ResetCts?.Cancel();
 | |
|             ResetCts?.Dispose();
 | |
|         }
 | |
|         catch { }
 | |
|     }
 | |
| 
 | |
|     public void IncreaseFailedAttempts()
 | |
|     {
 | |
|         Interlocked.Increment(ref failedAttempts);
 | |
|     }
 | |
| } |