diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-25 08:31:40 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-25 08:31:40 -0700 |
commit | a9fb696c40441e06ef817d7e28bae74c6a6cb6e4 (patch) | |
tree | e78f45395a2cee9592bceed86f3cbf2aba7c9022 /src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs | |
parent | e99268dcde5f942a2577a2d4d271febf991b6fa1 (diff) | |
download | DotNetOpenAuth-a9fb696c40441e06ef817d7e28bae74c6a6cb6e4.zip DotNetOpenAuth-a9fb696c40441e06ef817d7e28bae74c6a6cb6e4.tar.gz DotNetOpenAuth-a9fb696c40441e06ef817d7e28bae74c6a6cb6e4.tar.bz2 |
Added enough token management that the Appendix A scenario test is passing again.
Diffstat (limited to 'src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs')
-rw-r--r-- | src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs b/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs new file mode 100644 index 0000000..002eee1 --- /dev/null +++ b/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs @@ -0,0 +1,37 @@ +namespace DotNetOAuth.Test.Mocks {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using DotNetOAuth.ChannelElements;
+
+ internal class InMemoryTokenManager : ITokenManager {
+ Dictionary<string, string> consumersAndSecrets = new Dictionary<string, string>();
+ Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
+
+ #region ITokenManager Members
+
+ public string GetConsumerSecret(string consumerKey) {
+ return consumersAndSecrets[consumerKey];
+ }
+
+ public string GetTokenSecret(string token) {
+ return tokensAndSecrets[token];
+ }
+
+ public void StoreNewRequestToken(string consumerKey, string requestToken, string requestTokenSecret, IDictionary<string, string> parameters) {
+ tokensAndSecrets[requestToken] = requestTokenSecret;
+ }
+
+ public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
+ tokensAndSecrets.Remove(requestToken);
+ tokensAndSecrets[accessToken] = accessTokenSecret;
+ }
+
+ #endregion
+
+ internal void AddConsumer(string key, string secret) {
+ consumersAndSecrets.Add(key, secret);
+ }
+ }
+}
|