summaryrefslogtreecommitdiffstats
path: root/samples/OAuthConsumerWpf/MainWindow.xaml.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-09 21:54:37 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-09 21:54:37 -0700
commit5d58ebb1186351deba062b3309fcc4a69465b984 (patch)
tree24cdfab4b73525ac97c7f7f6851f6ea2d1cc7439 /samples/OAuthConsumerWpf/MainWindow.xaml.cs
parent5d9800cd4bf0e4cc90ba3c958a0ccd015f4c38f3 (diff)
downloadDotNetOpenAuth-5d58ebb1186351deba062b3309fcc4a69465b984.zip
DotNetOpenAuth-5d58ebb1186351deba062b3309fcc4a69465b984.tar.gz
DotNetOpenAuth-5d58ebb1186351deba062b3309fcc4a69465b984.tar.bz2
Added X.509 certificate use as an option to the OAuthConsumerWpf sample.
Diffstat (limited to 'samples/OAuthConsumerWpf/MainWindow.xaml.cs')
-rw-r--r--samples/OAuthConsumerWpf/MainWindow.xaml.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
index b4f1cc4..6c1c2ba 100644
--- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs
+++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
+ using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Windows;
@@ -35,9 +36,18 @@
public MainWindow() {
InitializeComponent();
- this.google = new DesktopConsumer(GoogleConsumer.ServiceDescription, this.tokenManager);
this.tokenManager.ConsumerKey = ConfigurationManager.AppSettings["googleConsumerKey"];
this.tokenManager.ConsumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];
+
+ string pfxFile = ConfigurationManager.AppSettings["googleConsumerCertificateFile"];
+ if (string.IsNullOrEmpty(pfxFile)) {
+ this.google = new DesktopConsumer(GoogleConsumer.ServiceDescription, this.tokenManager);
+ } else {
+ string pfxPassword = ConfigurationManager.AppSettings["googleConsumerCertificatePassword"];
+ var signingCertificate = new X509Certificate2(pfxFile, pfxPassword);
+ var service = GoogleConsumer.CreateRsaSha1ServiceDescription(signingCertificate);
+ this.google = new DesktopConsumer(service, this.tokenManager);
+ }
}
private void beginAuthorizationButton_Click(object sender, RoutedEventArgs e) {