Exemplo n.º 1
0
        public void Test()
        {
            var proxy = new UserProxy(BaseAddress);
            var user = proxy.Get(new AppCredentialModel
            {
                Key = UserKey,
                AppId = AppId
            }).Result;
            Assert.AreEqual(UserId, user.Id);
            Assert.IsNotEmpty(Token);
            Assert.AreEqual(AppSettings, user.Settings);

            proxy.Update(new AppCredentialModel
            {
                Key = UserKey,
                AppId = AppId
            }, new UpdateCredentialModel
            {
                Key = "5"
            }).Wait();

            UserKey = "5";

            user = proxy.Get(new AppCredentialModel
            {
                Key = UserKey,
                AppId = AppId
            }).Result;
            Assert.AreEqual(UserId, user.Id);

        }
Exemplo n.º 2
0
        private void LoadUser(UserId userId)
        {
            Logger.Debug("Opening user {userId}", userId);
            User = UserProxy.Get(userId);
            if (User.LinkedTo != null)
            {
                _unlinked = User;
                // Load user not through UserContext, because it can be linked to other user and so on.
                User = UserProxy.Get(User.LinkedTo.Item1);
                if (User.Token != _unlinked.LinkedTo.Item2)
                {
                    // Token was revoked, so unlink this user
                    Unlink();
                }
            }

            InitializeTimer();
        }