예제 #1
0
        protected HttpClient GetHttpClient()
        {
            HttpClient httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue("Bearer", propertiesService.GetJwtToken());
            return(httpClient);
        }
예제 #2
0
        private async Task <bool> IsTokenValid()
        {
            string token    = propertiesService.GetJwtToken();
            string userName = propertiesService.GetUserName();

            string[] userProperties = { token, userName };
            if (userProperties.Any(it => string.IsNullOrEmpty(it)))
            {
                return(false);
            }
            try
            {
                await applicationUsersService.GetApplicationUsersAsync();
            }
            catch (UnauthorizedAccessException)
            {
                return(false);
            }
            return(true);
        }