private async Task <UserInfo> GetUserInfo()
        {
            if (_userInfoCache != null && _userInfoCache.IsAuthenticated)
            {
                return(_userInfoCache);
            }
            _userInfoCache = await _authorizeApi.GetUserInfo();

            return(_userInfoCache);
        }
        public async Task <UserInfo> GetUserInfo()
        {
            if (userInfo != null)
            {
                return(userInfo);
            }
            userInfo = await _authorizeApi.GetUserInfo();

            return(userInfo);
        }
        public async Task <UserInfo> GetUserInfo()
        {
            if (userInfo != null && userInfo.IsAuthenticated)
            {
                return(userInfo);
            }
            userInfo = await _authorizeApi.GetUserInfo();

            return(userInfo);
        }
Example #4
0
        public async Task <UserInfoDto> GetUserInfo()
        {
            if (_userInfoCache != null && _userInfoCache.IsAuthenticated)
            {
                return(_userInfoCache);
            }

            //If the user is not authenticated then an empt UserInfoDto is returned
            _userInfoCache = await _authorizeApi.GetUserInfo();

            return(_userInfoCache);
        }
        public async Task <UserInfo> GetUserInfo()
        {
            Console.WriteLine("GetUserInfo");
            if (userInfo != null)
            {
                Console.WriteLine("GetUserInfo -> not null");
                Console.WriteLine($"GetUserInfo -> not null -> username: {userInfo.Username}");
                return(userInfo);
            }

            Console.WriteLine("GetUserInfo -> null -> get from server");
            userInfo = await _authorizeApi.GetUserInfo();

            return(userInfo);
        }
Example #6
0
        public async Task <UserInfoDto> GetUserInfo()
        {
            UserInfoDto userInfo        = _accountManager.GetUser();
            bool        IsAuthenticated = userInfo.IsAuthenticated;

            if (IsAuthenticated)
            {
                userInfo = await _authorizeApi.GetUserInfo();
            }
            else
            {
                userInfo = new UserInfoDto {
                    IsAuthenticated = false, Roles = new List <string>()
                };
            }
            return(userInfo);
        }