summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-08 16:22:58 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-08 16:22:58 -0700
commitd9c0ee017807cc17132e9c760d274afffc9b981c (patch)
tree28a79463a760a10c4d67cbac48f9a6af5cd25b32 /src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs
parent1c3247abc8fb37405d0602e5037b3cebbe8e944a (diff)
downloadDotNetOpenAuth-d9c0ee017807cc17132e9c760d274afffc9b981c.zip
DotNetOpenAuth-d9c0ee017807cc17132e9c760d274afffc9b981c.tar.gz
DotNetOpenAuth-d9c0ee017807cc17132e9c760d274afffc9b981c.tar.bz2
Split up ITokenManager into two derived interfaces to better fit Consumer and Service Provider scenarios.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs')
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs b/src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs
index 571bba7..be3c563 100644
--- a/src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/InMemoryTokenManager.cs
@@ -8,10 +8,11 @@ namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Linq;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
- internal class InMemoryTokenManager : ITokenManager {
+ internal class InMemoryTokenManager : IConsumerTokenManager, IServiceProviderTokenManager {
private Dictionary<string, string> consumersAndSecrets = new Dictionary<string, string>();
private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
@@ -25,12 +26,20 @@ namespace DotNetOpenAuth.Test.Mocks {
/// </summary>
private List<string> accessTokens = new List<string>();
- #region ITokenManager Members
+ #region IConsumerTokenManager Members
- public string GetConsumerSecret(string consumerKey) {
- return this.consumersAndSecrets[consumerKey];
+ public string ConsumerKey {
+ get { return this.consumersAndSecrets.Keys.Single(); }
+ }
+
+ public string ConsumerSecret {
+ get { return this.consumersAndSecrets.Values.Single(); }
}
+ #endregion
+
+ #region ITokenManager Members
+
public string GetTokenSecret(string token) {
return this.tokensAndSecrets[token];
}
@@ -82,6 +91,14 @@ namespace DotNetOpenAuth.Test.Mocks {
#endregion
+ #region IServiceProviderTokenManager Members
+
+ public string GetConsumerSecret(string consumerKey) {
+ return this.consumersAndSecrets[consumerKey];
+ }
+
+ #endregion
+
/// <summary>
/// Tells a Service Provider's token manager about a consumer and its secret
/// so that the SP can verify the Consumer's signed messages.