63 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			63 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								namespace FutureMailAPI.Models
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    public class OAuthClient
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        public int Id { get; set; }
							 | 
						||
| 
								 | 
							
								        public string ClientId { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public string ClientSecret { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public string Name { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public string RedirectUris { get; set; } = string.Empty; // JSON array
							 | 
						||
| 
								 | 
							
								        public string Scopes { get; set; } = string.Empty; // JSON array
							 | 
						||
| 
								 | 
							
								        public bool IsActive { get; set; } = true;
							 | 
						||
| 
								 | 
							
								        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
							 | 
						||
| 
								 | 
							
								        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    public class OAuthAuthorizationCode
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        public int Id { get; set; }
							 | 
						||
| 
								 | 
							
								        public string Code { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public int ClientId { get; set; }
							 | 
						||
| 
								 | 
							
								        public int UserId { get; set; }
							 | 
						||
| 
								 | 
							
								        public string RedirectUri { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public string Scopes { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public bool IsUsed { get; set; } = false;
							 | 
						||
| 
								 | 
							
								        public DateTime ExpiresAt { get; set; }
							 | 
						||
| 
								 | 
							
								        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								        // Navigation properties
							 | 
						||
| 
								 | 
							
								        public virtual OAuthClient Client { get; set; } = null!;
							 | 
						||
| 
								 | 
							
								        public virtual User User { get; set; } = null!;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    public class OAuthRefreshToken
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        public int Id { get; set; }
							 | 
						||
| 
								 | 
							
								        public string Token { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public int ClientId { get; set; }
							 | 
						||
| 
								 | 
							
								        public int UserId { get; set; }
							 | 
						||
| 
								 | 
							
								        public bool IsUsed { get; set; } = false;
							 | 
						||
| 
								 | 
							
								        public DateTime ExpiresAt { get; set; }
							 | 
						||
| 
								 | 
							
								        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								        // Navigation properties
							 | 
						||
| 
								 | 
							
								        public virtual OAuthClient Client { get; set; } = null!;
							 | 
						||
| 
								 | 
							
								        public virtual User User { get; set; } = null!;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    public class OAuthAccessToken
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        public int Id { get; set; }
							 | 
						||
| 
								 | 
							
								        public string Token { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public int ClientId { get; set; }
							 | 
						||
| 
								 | 
							
								        public int UserId { get; set; }
							 | 
						||
| 
								 | 
							
								        public string Scopes { get; set; } = string.Empty;
							 | 
						||
| 
								 | 
							
								        public bool IsRevoked { get; set; } = false;
							 | 
						||
| 
								 | 
							
								        public DateTime ExpiresAt { get; set; }
							 | 
						||
| 
								 | 
							
								        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								        // Navigation properties
							 | 
						||
| 
								 | 
							
								        public virtual OAuthClient Client { get; set; } = null!;
							 | 
						||
| 
								 | 
							
								        public virtual User User { get; set; } = null!;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |