summaryrefslogtreecommitdiffstats
path: root/samples/ServiceProvider/App_Code/DataApi.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-10-06 08:04:30 -0700
committerAndrew <andrewarnott@gmail.com>2008-10-06 08:04:30 -0700
commitf367f68a81e06dcab56348c85f7c09526123c916 (patch)
treec06ead228b7eb588ab783025ed05f816f5af5ee4 /samples/ServiceProvider/App_Code/DataApi.cs
parent5e8d26c757a32e3c0237b447d142a3de071fa992 (diff)
downloadDotNetOpenAuth-f367f68a81e06dcab56348c85f7c09526123c916.zip
DotNetOpenAuth-f367f68a81e06dcab56348c85f7c09526123c916.tar.gz
DotNetOpenAuth-f367f68a81e06dcab56348c85f7c09526123c916.tar.bz2
WCF OAuth sample now has 'real' database and login.
Diffstat (limited to 'samples/ServiceProvider/App_Code/DataApi.cs')
-rw-r--r--samples/ServiceProvider/App_Code/DataApi.cs15
1 files changed, 9 insertions, 6 deletions
diff --git a/samples/ServiceProvider/App_Code/DataApi.cs b/samples/ServiceProvider/App_Code/DataApi.cs
index 1a7555c..43f402a 100644
--- a/samples/ServiceProvider/App_Code/DataApi.cs
+++ b/samples/ServiceProvider/App_Code/DataApi.cs
@@ -1,14 +1,17 @@
-using System.Globalization;
+using System.Linq;
+using System.Globalization;
using System.ServiceModel;
public class DataApi : IDataApi {
- public int GetAge() {
- return 5;
+ public int? GetAge() {
+ return AccessToken.User.Age;
}
public string GetName() {
- string consumerKey = OperationContext.Current.IncomingMessageProperties["OAuthConsumerKey"] as string;
- string accessToken = OperationContext.Current.IncomingMessageProperties["OAuthAccessToken"] as string;
- return string.Format(CultureInfo.InvariantCulture, "Andrew_{0}_{1}", consumerKey.Substring(0, 1), accessToken.Substring(0, 1));
+ return AccessToken.User.FullName;
+ }
+
+ private static OAuthToken AccessToken {
+ get { return OperationContext.Current.IncomingMessageProperties["OAuthAccessToken"] as OAuthToken; }
}
}