41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
|
using Mirea.Api.Security.Common.Interfaces;
|
|||
|
using System.Text.Json.Serialization;
|
|||
|
|
|||
|
namespace Mirea.Api.Security.Common.Domain.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
|
|||
|
};
|
|||
|
}
|