summaryrefslogtreecommitdiffstats
path: root/samples/OAuthConsumer
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-06-07 21:29:29 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-06-07 21:29:29 -0700
commitb3a35b9ae0823dda35bb07b404c9c09fec09402a (patch)
treeb58aaf62cf23c1e2c06a0f1d5f13ab899fff6a04 /samples/OAuthConsumer
parent8ed398b9151c8fc140379756bd3bd546a46daf05 (diff)
downloadDotNetOpenAuth-b3a35b9ae0823dda35bb07b404c9c09fec09402a.zip
DotNetOpenAuth-b3a35b9ae0823dda35bb07b404c9c09fec09402a.tar.gz
DotNetOpenAuth-b3a35b9ae0823dda35bb07b404c9c09fec09402a.tar.bz2
Lots of StyleCop work, and one bug fix (can you find it? <g>)
Diffstat (limited to 'samples/OAuthConsumer')
-rw-r--r--samples/OAuthConsumer/SampleWcf2.aspx.cs34
-rw-r--r--samples/OAuthConsumer/SignInWithTwitter.aspx.cs2
2 files changed, 19 insertions, 17 deletions
diff --git a/samples/OAuthConsumer/SampleWcf2.aspx.cs b/samples/OAuthConsumer/SampleWcf2.aspx.cs
index b8eda9e..7fae00b 100644
--- a/samples/OAuthConsumer/SampleWcf2.aspx.cs
+++ b/samples/OAuthConsumer/SampleWcf2.aspx.cs
@@ -15,7 +15,7 @@
using OAuthConsumer.SampleServiceProvider;
public partial class SampleWcf2 : System.Web.UI.Page {
- private static InMemoryClientTokenManager TokenManager = new InMemoryClientTokenManager();
+ private static InMemoryClientTokenManager tokenManager = new InMemoryClientTokenManager();
private static IAuthorizationState Authorization {
get { return (AuthorizationState)HttpContext.Current.Session["Authorization"]; }
@@ -44,7 +44,7 @@
var client = CreateClient();
string clientState;
- var response = client.PrepareRequestUserAuthorization(TokenManager.NewAuthorization(scope, out clientState));
+ var response = client.PrepareRequestUserAuthorization(tokenManager.NewAuthorization(scope, out clientState));
response.ClientState = clientState;
client.Channel.Send(response);
}
@@ -75,9 +75,24 @@
}
}
+ private static WebServerClient CreateClient() {
+ var authServerDescription = new AuthorizationServerDescription {
+ TokenEndpoint = new Uri("http://localhost:65169/OAuth2.ashx/token"),
+ AuthorizationEndpoint = new Uri("http://localhost:65169/OAuth2.ashx/auth"),
+ };
+
+ var client = new WebServerClient(authServerDescription) {
+ ClientIdentifier = "sampleconsumer",
+ ClientSecret = "samplesecret",
+ TokenManager = tokenManager,
+ };
+
+ return client;
+ }
+
private T CallService<T>(Func<DataApiClient, T> predicate) {
DataApiClient client = new DataApiClient();
- //var serviceEndpoint = new MessageReceivingEndpoint(client.Endpoint.Address.Uri, HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest);
+ ////var serviceEndpoint = new MessageReceivingEndpoint(client.Endpoint.Address.Uri, HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest);
if (Authorization == null) {
throw new InvalidOperationException("No access token!");
}
@@ -93,18 +108,5 @@
return predicate(client);
}
}
-
- private static WebServerClient CreateClient() {
- var authServerDescription = new AuthorizationServerDescription {
- TokenEndpoint = new Uri("http://localhost:65169/OAuth2.ashx/token"),
- AuthorizationEndpoint = new Uri("http://localhost:65169/OAuth2.ashx/auth"),
- };
- var client = new WebServerClient(authServerDescription) {
- ClientIdentifier = "sampleconsumer",
- ClientSecret = "samplesecret",
- TokenManager = TokenManager,
- };
- return client;
- }
}
} \ No newline at end of file
diff --git a/samples/OAuthConsumer/SignInWithTwitter.aspx.cs b/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
index 5bc46ef..e104f3a 100644
--- a/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
+++ b/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
@@ -33,7 +33,7 @@
}
protected void signInButton_Click(object sender, ImageClickEventArgs e) {
- TwitterConsumer.StartSignInWithTwitter(forceLoginCheckbox.Checked).Send();
+ TwitterConsumer.StartSignInWithTwitter(this.forceLoginCheckbox.Checked).Send();
}
}
} \ No newline at end of file