using CustomerPortalV2.Common.Model.AccountModel; using Microsoft.AspNetCore.Http; using System.Security.Claims; namespace CustomerPortalV2.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 == ClaimTypes.Name).Value; model.ForceChangePassword = Convert.ToBoolean(claimIdentity.FindFirst(x => x.Type == "ForceChangePassword").Value); model.MobileNumber = claimIdentity.FindFirst(x => x.Type == "MobileNumber").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; } return model; } } }