Exemplo n.º 1
0
 private IVsCredentialKey GetCredentialKey(DesignTimeAuthentication authentication)
 {
     return(this.CredentialService.CreateCredentialKey(
                UserSettings.CredentialFeatureName,
                authentication.Domain.ToString(),
                authentication.UserName,
                "OAuthRefresh"));
 }
Exemplo n.º 2
0
        private static void OnLoaded(UserSettings userSettings)
        {
            for (int i = userSettings.MruDesignTimeAuthentications.Count() - 1; i >= 0; i--)
            {
                DesignTimeAuthentication authentication = userSettings.MruDesignTimeAuthentications[i];
                if (authentication.Version != DesignTimeAuthentication.CurrentVersion)
                {
                    // Currently if the authentication info cached in the MRU does not match the current version
                    // then it is simply removed.  At anytime this logic could be modified to perform an upgrade
                    // if the necessary requirements exist.
                    userSettings.MruDesignTimeAuthentications.Remove(authentication);
                    continue;
                }

                IVsCredentialKey key        = userSettings.GetCredentialKey(authentication);
                IVsCredential    credential = userSettings.CredentialService.Retrieve(key);
                authentication.RefreshToken = credential == null ? null : credential.TokenValue;
            }
        }