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);
        }
Exemplo n.º 2
0
        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);
        }