summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-06-08 06:00:14 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-06-08 06:00:14 -0700
commit67d4881942b6a145d299a8a32eee8f50ae09cc70 (patch)
tree587a6ef25d0689ac8455421e0c029a0723f3cc16 /samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
parente55d4a900b4c42ff37f449800d49b7972016e587 (diff)
downloadDotNetOpenAuth-67d4881942b6a145d299a8a32eee8f50ae09cc70.zip
DotNetOpenAuth-67d4881942b6a145d299a8a32eee8f50ae09cc70.tar.gz
DotNetOpenAuth-67d4881942b6a145d299a8a32eee8f50ae09cc70.tar.bz2
OAuth SP now works with 1.0 Consumers correctly.
Diffstat (limited to 'samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs')
-rw-r--r--samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
index 1a73461..143bbfb 100644
--- a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
+++ b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
@@ -52,7 +52,23 @@ public class DatabaseTokenManager : IServiceProviderTokenManager {
}
public Uri GetRequestTokenCallback(string requestToken) {
- return new Uri(Global.DataContext.OAuthTokens.First(token => token.Token == requestToken).RequestTokenCallback);
+ string callback = Global.DataContext.OAuthTokens.First(token => token.Token == requestToken).RequestTokenCallback;
+ return callback != null ? new Uri(callback) : null;
+ }
+
+ public void SetTokenConsumerVersion(string token, Version version) {
+ if (String.IsNullOrEmpty(token)) {
+ throw new ArgumentNullException("token");
+ }
+ if (version == null) {
+ throw new ArgumentNullException("version");
+ }
+
+ Global.DataContext.OAuthTokens.First(t => t.Token == token).ConsumerVersion = version.ToString();
+ }
+
+ public Version GetTokenConsumerVersion(string token) {
+ return new Version(Global.DataContext.OAuthTokens.First(t => t.Token == token).ConsumerVersion);
}
#endregion