Beispiel #1
0
 public void Sign(HttpRequestMessage msg)
 {
     _token = _token ?? ReadToken();
     if (_token == null)
     {
         throw new AuthExpiredException();
     }
     _oauth.Sign(msg, _token);
 }
Beispiel #2
0
        public void Update(OAuthConsumer.Token token, UserInfo userInfo)
        {
            using (var aes = new AesManaged())
            {
                var userId = Guid.NewGuid();
                SetEncryptionKey(aes.Key.Concat(aes.IV).ToArray());
                SetUserId(userId);

                using (var enc = aes.CreateEncryptor())
                {
                    var encryptedToken = Crypt(enc, Encoding.ASCII.GetBytes(token.Key + '@' + token.Secret));
                    SetUser(new UserIdentity
                    {
                        Id       = userId,
                        Token    = encryptedToken,
                        UserInfo = userInfo,
                    });
                }
            }
        }