summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-06-19 17:27:18 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-06-19 17:27:18 -0700
commit82c34d3f7e46f113b1c13145da0c388d9c328215 (patch)
tree18312208d8d0b08f3aa055a573116c33a268bd37 /samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
parentc071c9469d444ba356840b4ae0bc07b617147480 (diff)
parent42ec238847675f5943468fc6fc22b0e0bbf43f1c (diff)
downloadDotNetOpenAuth-82c34d3f7e46f113b1c13145da0c388d9c328215.zip
DotNetOpenAuth-82c34d3f7e46f113b1c13145da0c388d9c328215.tar.gz
DotNetOpenAuth-82c34d3f7e46f113b1c13145da0c388d9c328215.tar.bz2
Merge branch 'v3.0' into v3.1
Conflicts: src/DotNetOpenAuth.sln src/DotNetOpenAuth.vsmdi src/DotNetOpenAuth/DotNetOpenAuth.csproj src/DotNetOpenAuth/OAuth/ConsumerBase.cs src/DotNetOpenAuth/OAuth/OAuthStrings.Designer.cs src/DotNetOpenAuth/OAuth/OAuthStrings.resx src/DotNetOpenAuth/Yadis/Yadis.cs
Diffstat (limited to 'samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs')
-rw-r--r--samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
index 275a7c9..8ca4539 100644
--- a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
+++ b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
@@ -14,14 +14,22 @@ using DotNetOpenAuth.OAuth.Messages;
public class DatabaseTokenManager : IServiceProviderTokenManager {
#region IServiceProviderTokenManager
- public string GetConsumerSecret(string consumerKey) {
+ public IConsumerDescription GetConsumer(string consumerKey) {
var consumerRow = Global.DataContext.OAuthConsumers.SingleOrDefault(
consumerCandidate => consumerCandidate.ConsumerKey == consumerKey);
if (consumerRow == null) {
- throw new ArgumentException();
+ throw new KeyNotFoundException();
}
- return consumerRow.ConsumerSecret;
+ return consumerRow;
+ }
+
+ public IServiceProviderRequestToken GetRequestToken(string token) {
+ try {
+ return Global.DataContext.OAuthTokens.First(t => t.Token == token);
+ } catch (InvalidOperationException ex) {
+ throw new KeyNotFoundException("Unrecognized token", ex);
+ }
}
#endregion
@@ -51,6 +59,7 @@ public class DatabaseTokenManager : IServiceProviderTokenManager {
};
Global.DataContext.OAuthTokens.InsertOnSubmit(newToken);
+ Global.DataContext.SubmitChanges();
}
/// <summary>