refactor: distribute the domain folder
This commit is contained in:
		
							
								
								
									
										12
									
								
								Security/Common/OAuth2/OAuthTokenResponse.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Security/Common/OAuth2/OAuthTokenResponse.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Mirea.Api.Security.Common.OAuth2; | ||||
|  | ||||
| internal class OAuthTokenResponse | ||||
| { | ||||
|     [JsonPropertyName("access_token")] | ||||
|     public required string AccessToken { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("expires_in")] | ||||
|     public int ExpiresIn { get; set; } | ||||
| } | ||||
							
								
								
									
										39
									
								
								Security/Common/OAuth2/UserInfo/GoogleUserInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Security/Common/OAuth2/UserInfo/GoogleUserInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| using Mirea.Api.Security.Common.Domain; | ||||
| using Mirea.Api.Security.Common.Interfaces; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Mirea.Api.Security.Common.OAuth2.UserInfo; | ||||
|  | ||||
| internal class GoogleUserInfo : IUserInfo | ||||
| { | ||||
|     [JsonPropertyName("id")] | ||||
|     public required string Id { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("email")] | ||||
|     public required string Email { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("given_name")] | ||||
|     public required string GivenName { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("family_name")] | ||||
|     public required string FamilyName { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("name")] | ||||
|     public required string Name { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("picture")] | ||||
|     public required string Picture { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("verified_email")] | ||||
|     public bool? VerifiedEmail { get; set; } | ||||
|  | ||||
|     public OAuthUser MapToInternalUser() => | ||||
|         new() | ||||
|         { | ||||
|             Id = Id, | ||||
|             Email = VerifiedEmail.HasValue && VerifiedEmail.Value ? Email : null, | ||||
|             FirstName = GivenName, | ||||
|             LastName = FamilyName, | ||||
|             IconUri = Picture | ||||
|         }; | ||||
| } | ||||
							
								
								
									
										37
									
								
								Security/Common/OAuth2/UserInfo/MailRuUserInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Security/Common/OAuth2/UserInfo/MailRuUserInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| using Mirea.Api.Security.Common.Domain; | ||||
| using Mirea.Api.Security.Common.Interfaces; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Mirea.Api.Security.Common.OAuth2.UserInfo; | ||||
|  | ||||
| internal class MailRuUserInfo : IUserInfo | ||||
| { | ||||
|     [JsonPropertyName("id")] | ||||
|     public required string Id { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("email")] | ||||
|     public required string Email { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("first_name")] | ||||
|     public required string FirstName { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("last_name")] | ||||
|     public required string LastName { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("nickname")] | ||||
|     public required string Username { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("image")] | ||||
|     public string? Image { get; set; } | ||||
|  | ||||
|     public OAuthUser MapToInternalUser() => | ||||
|         new() | ||||
|         { | ||||
|             Id = Id, | ||||
|             Email = Email, | ||||
|             FirstName = FirstName, | ||||
|             LastName = LastName, | ||||
|             Username = Username, | ||||
|             IconUri = Image | ||||
|         }; | ||||
| } | ||||
							
								
								
									
										42
									
								
								Security/Common/OAuth2/UserInfo/YandexUserInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Security/Common/OAuth2/UserInfo/YandexUserInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| using Mirea.Api.Security.Common.Domain; | ||||
| using Mirea.Api.Security.Common.Interfaces; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Mirea.Api.Security.Common.OAuth2.UserInfo; | ||||
|  | ||||
| internal class YandexUserInfo : IUserInfo | ||||
| { | ||||
|     [JsonPropertyName("id")] | ||||
|     public required string Id { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("login")] | ||||
|     public required string Login { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("default_email")] | ||||
|     public required string DefaultEmail { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("first_name")] | ||||
|     public string? FirstName { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("last_name")] | ||||
|     public string? LastName { get; set; } | ||||
|  | ||||
|  | ||||
|     [JsonPropertyName("is_avatar_empty")] | ||||
|     public bool IsAvatarEmpty { get; set; } | ||||
|  | ||||
|     [JsonPropertyName("default_avatar_id")] | ||||
|     public string? DefaultAvatarId { get; set; } | ||||
|  | ||||
|     public OAuthUser MapToInternalUser() => | ||||
|         new() | ||||
|         { | ||||
|             Id = Id, | ||||
|             Email = DefaultEmail, | ||||
|             FirstName = FirstName, | ||||
|             LastName = LastName, | ||||
|             IconUri = | ||||
|                 IsAvatarEmpty ? null : $"https://avatars.yandex.net/get-yapic/{DefaultAvatarId}/islands-retina-50", | ||||
|             Username = Login | ||||
|         }; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user