public IUserAuthData GetCurrentUser() { Sabio.Models.Domain.UserBase baseUser = null; if (IsLoggedIn()) { ClaimsIdentity claimsIdentity = _contextAccessor.HttpContext.User.Identity as ClaimsIdentity; if (claimsIdentity != null) { baseUser = ExtractUser(claimsIdentity); } } return(baseUser); }
public static IUserAuthData GetCurrentUser(this IIdentity identity) { Sabio.Models.Domain.UserBase baseUser = null; if (identity == null) { throw new ArgumentNullException("identity"); } if (identity.IsAuthenticated) { ClaimsIdentity claimsIdentity = identity as ClaimsIdentity; if (claimsIdentity != null) { baseUser = ExtractUser(claimsIdentity); } } return(baseUser); }