Exemplo n.º 1
0
        public async Task <DevAccount> SignInAsync(string userName)
        {
            string aadToken = await authContext.AcquireTokenAsync(userName);

            XdtsTokenResponse token = await FetchXdtsToken(aadToken, string.Empty, string.Empty);

            return(new DevAccount(token, this.authContext.AccountSource));
        }
Exemplo n.º 2
0
        protected bool TryGetCachedToken(string key, out string token)
        {
            token = string.Empty;
            XdtsTokenResponse cachedToken = null;

            if (cachedTokens.TryGetValue(key, out cachedToken) &&
                (cachedToken != null && !string.IsNullOrEmpty(cachedToken.Token) && cachedToken.NotAfter >= DateTime.UtcNow))
            {
                Log.WriteLog($"Using token from cache for {key}.");

                token = cachedToken.Token;
                return(true);
            }

            return(false);
        }