Credentials CreateFromLoginInfo(LoginInfo loginInfo)
        {
            if (loginInfo == LoginCache.EmptyLoginInfo)
            {
                log.Debug(CultureInfo.InvariantCulture, "Could not retrieve login info from the secure cache '{0}'",
                    hostAddress.CredentialCacheKeyHost);
                return Credentials.Anonymous;
            }

            return new Credentials(loginInfo.UserName, loginInfo.Password);
        }
예제 #2
0
        public async Task<LoginInfo> GetLoginInfoAsync()
        {
            bool errored = false;
            var loginInfo = new LoginInfo("", "");
            try
            {
                //TODO: Firgure out why this does not work or errors out
                loginInfo = await BlobCache.Secure.GetLoginAsync()
                    .Catch((Func<KeyNotFoundException, IObservable<LoginInfo>>)((e) =>
                        Observable.Return(new LoginInfo(string.Empty, string.Empty))));
            }
            catch (KeyNotFoundException)
            {
                errored = true;
            }

            if (errored)
            {
                await DeleteToken();
            }

            return loginInfo;
        }