summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs
diff options
context:
space:
mode:
authorAndrás Fuchs <andras.fuchs@gmail.com>2013-05-26 07:54:53 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2013-05-26 07:54:53 -0700
commit2a4da5e544a22d30d5b54a2696194d814d9a442f (patch)
treeed76c7421e9669bbf263381139a29afb8eb23433 /samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs
parent85c21ae12f04cc50a0478cf69c82d441da23d002 (diff)
downloadDotNetOpenAuth-2a4da5e544a22d30d5b54a2696194d814d9a442f.zip
DotNetOpenAuth-2a4da5e544a22d30d5b54a2696194d814d9a442f.tar.gz
DotNetOpenAuth-2a4da5e544a22d30d5b54a2696194d814d9a442f.tar.bz2
Samples improvements
The part which I needed to improve is the ApplicationBlock where I changed the OAuth2 classes' structure a little and extended them with a lot of useful functionality, like adding many Facebook and WindowsLive scopes, fields, structures including the asked-by-many easy to use birthdate and avatar url getters. I have also implemented the Google OAuth2 authentication and created one common interface for all 3 Graphs in the code (which has the common properties like Id, FirstName, LastName, etc.), so the authentication code became really simple if you use my version of your ApplicationBlock.
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs60
1 files changed, 0 insertions, 60 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs b/samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs
deleted file mode 100644
index 4801226..0000000
--- a/samples/DotNetOpenAuth.ApplicationBlock/WindowsLiveGraph.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="WindowsLiveGraph.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.ApplicationBlock {
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Runtime.Serialization.Json;
- using System.Text;
-
- [DataContract]
- public class WindowsLiveGraph {
- private static DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(WindowsLiveGraph));
-
- [DataMember(Name = "id")]
- public string Id { get; set; }
-
- [DataMember(Name = "name")]
- public string Name { get; set; }
-
- [DataMember(Name = "first_name")]
- public string FirstName { get; set; }
-
- [DataMember(Name = "last_name")]
- public string LastName { get; set; }
-
- [DataMember(Name = "link")]
- public Uri Link { get; set; }
-
- [DataMember(Name = "gender")]
- public string Gender { get; set; }
-
- [DataMember(Name = "updated_time")]
- public string UpdatedTime { get; set; }
-
- [DataMember(Name = "locale")]
- public string Locale { get; set; }
-
- public static WindowsLiveGraph Deserialize(string json) {
- if (string.IsNullOrEmpty(json)) {
- throw new ArgumentNullException("json");
- }
-
- return Deserialize(new MemoryStream(Encoding.UTF8.GetBytes(json)));
- }
-
- public static WindowsLiveGraph Deserialize(Stream jsonStream) {
- if (jsonStream == null) {
- throw new ArgumentNullException("jsonStream");
- }
-
- return (WindowsLiveGraph)jsonSerializer.ReadObject(jsonStream);
- }
- }
-}