diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-04 18:51:45 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-04 18:51:45 -0700 |
commit | a4dcb24c11ccaf95bb6a2bc5ca505d2e19640cd4 (patch) | |
tree | 143fbe4d84c2994e9962cfe6bdb8c83ada99be0d /samples | |
parent | 43f5260542eb1b1b15c7f46f95c6034e8796d20e (diff) | |
download | DotNetOpenAuth-a4dcb24c11ccaf95bb6a2bc5ca505d2e19640cd4.zip DotNetOpenAuth-a4dcb24c11ccaf95bb6a2bc5ca505d2e19640cd4.tar.gz DotNetOpenAuth-a4dcb24c11ccaf95bb6a2bc5ca505d2e19640cd4.tar.bz2 |
OAuth 2.0 sample works, draft 9 style.
Diffstat (limited to 'samples')
-rw-r--r-- | samples/OAuthConsumer/SampleWcf2.aspx.cs | 3 | ||||
-rw-r--r-- | samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs | 3 | ||||
-rw-r--r-- | samples/OAuthServiceProvider/OAuth2.ashx.cs | 5 |
3 files changed, 5 insertions, 6 deletions
diff --git a/samples/OAuthConsumer/SampleWcf2.aspx.cs b/samples/OAuthConsumer/SampleWcf2.aspx.cs index 6b6ced2..a4f0f1c 100644 --- a/samples/OAuthConsumer/SampleWcf2.aspx.cs +++ b/samples/OAuthConsumer/SampleWcf2.aspx.cs @@ -31,7 +31,8 @@ } } - if (Authorization != null) { + // Refresh the access token if it expires and if its lifetime is too short to be of use. + if (Authorization != null && Authorization.AccessTokenExpirationUtc.HasValue) { client.RefreshToken(Authorization, TimeSpan.FromMinutes(1)); } } diff --git a/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs b/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs index 1f8f56e..f0c10d1 100644 --- a/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs +++ b/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Web; using DotNetOpenAuth.Messaging.Bindings; + using System.Data.SqlClient; /// <summary> /// A database-persisted nonce store. @@ -47,6 +48,8 @@ return true; } catch (System.Data.Linq.DuplicateKeyException) { return false; + } catch (SqlException) { + return false; } } diff --git a/samples/OAuthServiceProvider/OAuth2.ashx.cs b/samples/OAuthServiceProvider/OAuth2.ashx.cs index 259803a..62aa680 100644 --- a/samples/OAuthServiceProvider/OAuth2.ashx.cs +++ b/samples/OAuthServiceProvider/OAuth2.ashx.cs @@ -38,11 +38,6 @@ throw new HttpException((int)HttpStatusCode.BadRequest, "Missing authorization request."); } - // This sample doesn't implement support for immediate mode. - if (!request.IsUserInteractionAllowed) { - Global.AuthorizationServer.RejectAuthorizationRequest(request); - } - // Redirect the user to a page that requires the user to be logged in. Global.PendingOAuth2Authorization = request; context.Response.Redirect("~/Members/Authorize2.aspx"); |