From ae1faaf2f45ba9e27b4e1c9c76649804490ded03 Mon Sep 17 00:00:00 2001 From: AnonymousDotNet <18776095145@163.com> Date: Tue, 6 Aug 2024 18:50:40 +0800 Subject: [PATCH] Add User Phone Attribute --- .../BotSharp.Abstraction/Users/IUserIdentity.cs | 1 + .../BotSharp.Core/Users/Services/UserIdentity.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Users/IUserIdentity.cs b/src/Infrastructure/BotSharp.Abstraction/Users/IUserIdentity.cs index 4fecb48c..4d32d241 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Users/IUserIdentity.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Users/IUserIdentity.cs @@ -9,4 +9,5 @@ public interface IUserIdentity string LastName { get; } string FullName { get; } string? UserLanguage { get; } + string? Phone { get; } } diff --git a/src/Infrastructure/BotSharp.Core/Users/Services/UserIdentity.cs b/src/Infrastructure/BotSharp.Core/Users/Services/UserIdentity.cs index a8eaac5e..ee3b5c75 100644 --- a/src/Infrastructure/BotSharp.Core/Users/Services/UserIdentity.cs +++ b/src/Infrastructure/BotSharp.Core/Users/Services/UserIdentity.cs @@ -40,7 +40,7 @@ public class UserIdentity : IUserIdentity } [JsonPropertyName("last_name")] - public string LastName + public string LastName => _claims?.FirstOrDefault(x => x.Type == ClaimTypes.Surname)?.Value!; [JsonPropertyName("full_name")] @@ -66,4 +66,7 @@ public class UserIdentity : IUserIdentity return languages.FirstOrDefault(); } } + + [JsonPropertyName("phone")] + public string? Phone => _claims?.FirstOrDefault(x => x.Type == "phone")?.Value; }