summaryrefslogtreecommitdiffstats
path: root/samples/OAuthAuthorizationServer/Code/Client.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-06-20 21:26:56 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-06-20 21:26:56 -0700
commit507e88d5c3e8263da48a0b9e695a35bc051f6b56 (patch)
treed5753afe4d0f5be1c652032a5af2751b0de77064 /samples/OAuthAuthorizationServer/Code/Client.cs
parent1f77a2b10ed11ac084d1def41b3c891178b0520b (diff)
downloadDotNetOpenAuth-507e88d5c3e8263da48a0b9e695a35bc051f6b56.zip
DotNetOpenAuth-507e88d5c3e8263da48a0b9e695a35bc051f6b56.tar.gz
DotNetOpenAuth-507e88d5c3e8263da48a0b9e695a35bc051f6b56.tar.bz2
We have an implicit grant javascript client that can obtain an access token.
It doesn't know how to use it yet though.
Diffstat (limited to 'samples/OAuthAuthorizationServer/Code/Client.cs')
-rw-r--r--samples/OAuthAuthorizationServer/Code/Client.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/samples/OAuthAuthorizationServer/Code/Client.cs b/samples/OAuthAuthorizationServer/Code/Client.cs
index 62bc193..b32bb15 100644
--- a/samples/OAuthAuthorizationServer/Code/Client.cs
+++ b/samples/OAuthAuthorizationServer/Code/Client.cs
@@ -37,7 +37,19 @@
/// <c>true</c> if the callback URL is allowable for this client; otherwise, <c>false</c>.
/// </returns>
bool IConsumerDescription.IsCallbackAllowed(Uri callback) {
- return string.IsNullOrEmpty(this.Callback) || callback == new Uri(this.Callback);
+ if (string.IsNullOrEmpty(this.Callback)) {
+ // No callback rules have been set up for this client.
+ return true;
+ }
+
+ // In this sample, it's enough of a callback URL match if the scheme and host match.
+ // In a production app, it is advisable to require a match on the path as well.
+ Uri acceptableCallbackPattern = new Uri(this.Callback);
+ if (String.Equals(acceptableCallbackPattern.GetLeftPart(UriPartial.Authority), callback.GetLeftPart(UriPartial.Authority), StringComparison.Ordinal)) {
+ return true;
+ }
+
+ return false;
}
#endregion