summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-09 07:54:24 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-09 07:54:24 -0700
commit16ca42988d40f06adfd259098ef2a1507fd1c731 (patch)
tree5f53dd6642799f64937f794dc0d66bfb47d4278a
parent266e65da43dc5d3b785af7d22ac0dc11274550c2 (diff)
downloadDotNetOpenAuth-16ca42988d40f06adfd259098ef2a1507fd1c731.zip
DotNetOpenAuth-16ca42988d40f06adfd259098ef2a1507fd1c731.tar.gz
DotNetOpenAuth-16ca42988d40f06adfd259098ef2a1507fd1c731.tar.bz2
Moved OAuth consumer WPF sample's consumer key and secret into its app.config file.
-rw-r--r--samples/OAuthConsumerWpf/App.config8
-rw-r--r--samples/OAuthConsumerWpf/MainWindow.xaml12
-rw-r--r--samples/OAuthConsumerWpf/MainWindow.xaml.cs9
-rw-r--r--samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj1
4 files changed, 16 insertions, 14 deletions
diff --git a/samples/OAuthConsumerWpf/App.config b/samples/OAuthConsumerWpf/App.config
index bfe1c86..fc3db87 100644
--- a/samples/OAuthConsumerWpf/App.config
+++ b/samples/OAuthConsumerWpf/App.config
@@ -4,6 +4,14 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
</configSections>
+ <appSettings>
+ <!-- Fill in your various consumer keys and secrets here to make the sample work. -->
+ <!-- You must get these values by signing up with each individual service provider. -->
+ <!-- Google sign-up: https://www.google.com/accounts/ManageDomains -->
+ <add key="googleConsumerKey" value=""/>
+ <add key="googleConsumerSecret" value=""/>
+ </appSettings>
+
<system.net>
<defaultProxy enabled="true" />
</system.net>
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml b/samples/OAuthConsumerWpf/MainWindow.xaml
index f422353..fb036ce 100644
--- a/samples/OAuthConsumerWpf/MainWindow.xaml
+++ b/samples/OAuthConsumerWpf/MainWindow.xaml
@@ -18,18 +18,6 @@
<Button Name="beginAuthorizationButton" Click="beginAuthorizationButton_Click">Start authorize</Button>
<Button Name="completeAuthorizationButton" Margin="5,0,0,0" Click="completeAuthorizationButton_Click" IsEnabled="false">Complete authorization</Button>
</StackPanel>
- <Label>Consumer Key</Label>
- <TextBox Grid.Column="1" Name="consumerKeyBox"/>
- <Label Grid.Row="1">Consumer Secret</Label>
- <TextBox Grid.Row="1" Grid.Column="1" Name="consumerSecretBox"/>
- <Label Grid.Row="2" Grid.Column="1">
- <TextBlock>
- Don't have a Google Consumer Key?
- <Hyperlink NavigateUri="https://www.google.com/accounts/ManageDomains">
- <TextBlock>Get one!</TextBlock>
- </Hyperlink>
- </TextBlock>
- </Label>
<TabControl Grid.ColumnSpan="2" Grid.Row="4" Name="tabControl1" Margin="0,10,0,0">
<TabItem Header="Gmail Contacts" Name="gmailContactsTab">
<Grid Name="contactsGrid">
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
index bf65431..1c8d0aa 100644
--- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs
+++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
@@ -1,6 +1,7 @@
namespace DotNetOpenAuth.Samples.OAuthConsumerWpf {
using System;
using System.Collections.Generic;
+ using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
@@ -35,11 +36,15 @@
InitializeComponent();
this.google = new DesktopConsumer(GoogleConsumer.ServiceDescription, this.tokenManager);
+ this.tokenManager.ConsumerKey = ConfigurationManager.AppSettings["googleConsumerKey"];
+ this.tokenManager.ConsumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];
}
private void beginAuthorizationButton_Click(object sender, RoutedEventArgs e) {
- this.tokenManager.ConsumerKey = consumerKeyBox.Text;
- this.tokenManager.ConsumerSecret = consumerSecretBox.Text;
+ if (string.IsNullOrEmpty(this.tokenManager.ConsumerKey)) {
+ MessageBox.Show(this, "You must modify the App.config or OAuthConsumerWpf.exe.config file for this application to include your Google OAuth consumer key first.", "Configuration required", MessageBoxButton.OK, MessageBoxImage.Stop);
+ return;
+ }
Cursor original = this.Cursor;
this.Cursor = Cursors.Wait;
diff --git a/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj b/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj
index 72159c9..7284867 100644
--- a/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj
+++ b/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj
@@ -49,6 +49,7 @@
</Reference>
<Reference Include="Microsoft.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL" />
<Reference Include="System" />
+ <Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>