using CustomerOnlineV2.Common.Models.AccountModel; using Microsoft.AspNetCore.Http; using System.Security.Claims; namespace CustomerOnlineV2.Common.Helper { public static class LoginUserInfo { public static LoginResponse GetLoginDetails(this HttpContext context) { var claimIdentity = context.User.Identity as ClaimsIdentity; var model = new LoginResponse(); if (claimIdentity.IsAuthenticated) { model.UserName = claimIdentity.FindFirst(x => x.Type == "UserName").Value; model.FullName = claimIdentity.FindFirst(x => x.Type == "FullName").Value; model.ForceChangePassword = Convert.ToBoolean(claimIdentity.FindFirst(x => x.Type == "ForceChangePassword").Value); model.MobileNumber = claimIdentity.FindFirst(x => x.Type == "MobileNumber").Value; model.MembershipId = claimIdentity.FindFirst(x => x.Type == "MembershipId").Value; model.Email = claimIdentity.FindFirst(x => x.Type == "Email").Value; model.RememberMe = Convert.ToBoolean(claimIdentity.FindFirst(x => x.Type == "RememberMe").Value); model.SessionId = claimIdentity.FindFirst(x => x.Type == "SessionId").Value; model.UserId = claimIdentity.FindFirst(x => x.Type == "UserId").Value; } return model; } } }