示例#1
0
        public async Task <CurrentLoginInformationsOutput> GetCurrentLoginInformationsAsync()
        {
            var output = new CurrentLoginInformationsOutput
            {
                User = (await GetCurrentUserAsync()).MapTo <UserLoginInfoDto>()
            };

            if (InfrastructureSession.TenantId.HasValue)
            {
                output.Tenant = (await GetCurrentTenantAsync()).MapTo <TenantLoginInfoDto>();
            }
            return(output);
        }
示例#2
0
        public CurrentLoginInformationsOutput GetCurrentLoginInformations()
        {
            var output = new CurrentLoginInformationsOutput
            {
                User = GetCurrentUser().MapTo <UserLoginInfoDto>()
            };

            if (InfrastructureSession.TenantId.HasValue)
            {
                output.Tenant = GetCurrentTenant().MapTo <TenantLoginInfoDto>();
            }
            return(output);
        }
示例#3
0
        public CurrentLoginInformationsOutput GetCurrentLoginInformations()
        {
            var output = new CurrentLoginInformationsOutput
            {
                Application = new ApplicationInfoOutput
                {
                    Version     = AppVersionHelper.Version,
                    ReleaseDate = AppVersionHelper.ReleaseDate,
                    Features    = new Dictionary <string, bool>()
                }
            };

            if (_contextAccessor.HttpContext.User.Identity?.IsAuthenticated == true)
            {
                string userDataJsonStr = _contextAccessor.HttpContext.User.Claims.Where(claim => claim.Type == ClaimTypes.UserData).FirstOrDefault().Value;
                output.User = JsonConvert.DeserializeObject <LoginUserOutput>(userDataJsonStr);
            }
            return(output);
        }