diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-18 15:31:13 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-18 15:31:13 -0700 |
commit | c624d966756fcd69928565588445026efa31b4f3 (patch) | |
tree | 6a092f7d0403caa9d10e52c23e1be2c63dea9938 | |
parent | c1ed5e2627ab5b93481a795b4e5c9cd4109b65b6 (diff) | |
download | DotNetOpenAuth-c624d966756fcd69928565588445026efa31b4f3.zip DotNetOpenAuth-c624d966756fcd69928565588445026efa31b4f3.tar.gz DotNetOpenAuth-c624d966756fcd69928565588445026efa31b4f3.tar.bz2 |
Renamed some WRAP terms to oauth2
-rw-r--r-- | samples/OAuthConsumerWpf/MainWindow.xaml | 20 | ||||
-rw-r--r-- | samples/OAuthConsumerWpf/MainWindow.xaml.cs | 37 |
2 files changed, 23 insertions, 34 deletions
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml b/samples/OAuthConsumerWpf/MainWindow.xaml index 825de07..6ba0c69 100644 --- a/samples/OAuthConsumerWpf/MainWindow.xaml +++ b/samples/OAuthConsumerWpf/MainWindow.xaml @@ -153,10 +153,10 @@ <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <Label Grid.Row="1" TabIndex="202">Token Endpoint URL</Label> - <TextBox Grid.Row="1" Grid.Column="1" x:Name="wrapTokenUrlBox" Text="http://localhost:18916/OAuthTokenEndpoint.ashx" TabIndex="203" /> + <TextBox Grid.Row="1" Grid.Column="1" x:Name="oauth2TokenEndpointBox" Text="http://localhost:18916/OAuthTokenEndpoint.ashx" TabIndex="203" /> <Label Grid.Row="1" Grid.Column="2" TabIndex="204">POST</Label> <Label Grid.Row="2" TabIndex="205">User Authorization URL</Label> - <TextBox Grid.Row="2" Grid.Column="1" x:Name="wrapAuthorizationUrlBox" Text="http://localhost:18916/Account/Authorize" TabIndex="206" /> + <TextBox Grid.Row="2" Grid.Column="1" x:Name="oauth2AuthorizationUrlBox" Text="http://localhost:18916/Account/Authorize" TabIndex="206" /> <Label Grid.Row="2" Grid.Column="2" TabIndex="207">GET</Label> <Label Grid.Row="0" TabIndex="200">Grant Type</Label> <ComboBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" x:Name="flowBox" SelectedIndex="0" TabIndex="201"> @@ -167,8 +167,8 @@ </ComboBox.Items> </ComboBox> <Label Grid.Row="3" TabIndex="207">Resource URL</Label> - <TextBox Grid.Row="3" Grid.Column="1" x:Name="wrapResourceUrlBox" Text="http://localhost:18916/" TabIndex="208" /> - <ComboBox Grid.Row="3" Grid.Column="2" x:Name="wrapResourceHttpMethodList" SelectedIndex="0" TabIndex="209"> + <TextBox Grid.Row="3" Grid.Column="1" x:Name="oauth2ResourceUrlBox" Text="http://localhost:18916/" TabIndex="208" /> + <ComboBox Grid.Row="3" Grid.Column="2" x:Name="oauth2ResourceHttpMethodList" SelectedIndex="0" TabIndex="209"> <ComboBox.Items> <ComboBoxItem>GET w/ header</ComboBoxItem> <ComboBoxItem>GET w/ querystring</ComboBoxItem> @@ -176,19 +176,19 @@ </ComboBox.Items> </ComboBox> <Label Grid.Row="4" TabIndex="210">Client Identifier</Label> - <TextBox Grid.Row="4" Grid.Column="1" x:Name="wrapClientIdentifierBox" Grid.ColumnSpan="2" Text="a" TabIndex="211" /> + <TextBox Grid.Row="4" Grid.Column="1" x:Name="oauth2ClientIdentifierBox" Grid.ColumnSpan="2" Text="a" TabIndex="211" /> <Label Grid.Row="5" TabIndex="212">Client Secret</Label> - <TextBox Grid.Row="5" Grid.Column="1" x:Name="wrapClientSecretBox" Grid.ColumnSpan="2" Text="b" TabIndex="213" /> + <TextBox Grid.Row="5" Grid.Column="1" x:Name="oauth2ClientSecretBox" Grid.ColumnSpan="2" Text="b" TabIndex="213" /> <Label Grid.Row="6" TabIndex="214">Scope</Label> - <TextBox Grid.Row="6" Grid.Column="1" x:Name="wrapScopeBox" TabIndex="215" Text="some scope" /> + <TextBox Grid.Row="6" Grid.Column="1" x:Name="oauth2ScopeBox" TabIndex="215" Text="some scope" /> <Label Grid.Row="7" TabIndex="216">OAuth 2.0 version</Label> - <ComboBox Grid.Row="7" Grid.Column="1" SelectedIndex="0" x:Name="wrapVersion" TabIndex="217"> + <ComboBox Grid.Row="7" Grid.Column="1" SelectedIndex="0" x:Name="oauth2Version" TabIndex="217"> <ComboBox.Items> <ComboBoxItem>2.0 DRAFT 9</ComboBoxItem> </ComboBox.Items> </ComboBox> - <Button Grid.Row="8" Grid.Column="1" x:Name="wrapBeginButton" Click="wrapBeginButton_Click" TabIndex="218">Begin</Button> - <TextBox Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="3" Name="wrapResultsBox" IsReadOnly="True" TabIndex="219"/> + <Button Grid.Row="8" Grid.Column="1" x:Name="oauth2BeginButton" Click="oauth2BeginButton_Click" TabIndex="218">Begin</Button> + <TextBox Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="3" Name="oauth2ResultsBox" IsReadOnly="True" TabIndex="219"/> </Grid> </TabItem> </TabControl> diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs index 46a5f06..b6ae52f 100644 --- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs +++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs @@ -9,21 +9,10 @@ using System.Security.Cryptography.X509Certificates; using System.ServiceModel; using System.ServiceModel.Channels; - using System.Text; - using System.Threading; using System.Windows; using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Documents; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Media.Imaging; - using System.Windows.Navigation; - using System.Windows.Shapes; - using System.Xml; using System.Xml.Linq; - using System.Xml.XPath; - using DotNetOpenAuth; + using DotNetOpenAuth.ApplicationBlock; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OAuth; @@ -92,7 +81,7 @@ return; } - Authorize auth = new Authorize( + var auth = new Authorize( this.google, (DesktopConsumer consumer, out string requestToken) => GoogleConsumer.RequestAuthorization( @@ -205,37 +194,37 @@ } } - private void wrapBeginButton_Click(object sender, RoutedEventArgs e) { + private void oauth2BeginButton_Click(object sender, RoutedEventArgs e) { var authServer = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription { - AuthorizationEndpoint = new Uri(wrapAuthorizationUrlBox.Text), + AuthorizationEndpoint = new Uri(oauth2AuthorizationUrlBox.Text), }; - if (wrapTokenUrlBox.Text.Length > 0) { - authServer.TokenEndpoint = new Uri(wrapTokenUrlBox.Text); + if (oauth2TokenEndpointBox.Text.Length > 0) { + authServer.TokenEndpoint = new Uri(oauth2TokenEndpointBox.Text); } try { ////var client = new DotNetOpenAuth.OAuth2.WebAppClient(authServer); ////client.PrepareRequestUserAuthorization(); - var client = new OAuth2.UserAgentClient(authServer, wrapClientIdentifierBox.Text); - client.ClientSecret = wrapClientSecretBox.Text; + var client = new OAuth2.UserAgentClient(authServer, oauth2ClientIdentifierBox.Text); + client.ClientSecret = oauth2ClientSecretBox.Text; - var authorization = new AuthorizationState { Scope = wrapScopeBox.Text }; + var authorization = new AuthorizationState { Scope = oauth2ScopeBox.Text }; var authorizePopup = new Authorize2(client, authorization); authorizePopup.Owner = this; bool? result = authorizePopup.ShowDialog(); if (result.HasValue && result.Value) { // One method of OAuth authorization is to tack the ?access_token= onto the query string. - var address = new Uri(wrapResourceUrlBox.Text); - address = new Uri(wrapResourceUrlBox.Text + (string.IsNullOrEmpty(address.Query) ? "?" : string.Empty) + "access_token=" + Uri.EscapeDataString(authorizePopup.Authorization.AccessToken)); + var address = new Uri(oauth2ResourceUrlBox.Text); + address = new Uri(oauth2ResourceUrlBox.Text + (string.IsNullOrEmpty(address.Query) ? "?" : string.Empty) + "access_token=" + Uri.EscapeDataString(authorizePopup.Authorization.AccessToken)); var request = (HttpWebRequest)WebRequest.Create(address); // This method tacks on the Authorization header client.AuthorizeRequest(request, authorizePopup.Authorization); - request.Method = wrapResourceHttpMethodList.SelectedIndex < 2 ? "GET" : "POST"; + request.Method = oauth2ResourceHttpMethodList.SelectedIndex < 2 ? "GET" : "POST"; using (var resourceResponse = request.GetResponse()) { using (var responseStream = new StreamReader(resourceResponse.GetResponseStream())) { - wrapResultsBox.Text = responseStream.ReadToEnd(); + oauth2ResultsBox.Text = responseStream.ReadToEnd(); } } } else { |