summaryrefslogtreecommitdiffstats
path: root/samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-05-27 19:51:35 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-05-27 19:51:35 -0700
commitc0cc7af4c210103a2ef6f3144e307bcd130a77d1 (patch)
treef076211bf9b9b74b323b3d1af39b86caf8bc48eb /samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs
parent537a2a72b130ee50f9c01c6bcd9510875ee3f820 (diff)
downloadDotNetOpenAuth-c0cc7af4c210103a2ef6f3144e307bcd130a77d1.zip
DotNetOpenAuth-c0cc7af4c210103a2ef6f3144e307bcd130a77d1.tar.gz
DotNetOpenAuth-c0cc7af4c210103a2ef6f3144e307bcd130a77d1.tar.bz2
Various fixes to the sample OAuth 2.0 Authorization Server sample.
Diffstat (limited to 'samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs')
-rw-r--r--samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs b/samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs
index 90f99f8..e2e4325 100644
--- a/samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs
+++ b/samples/OAuthAuthorizationServer/Code/OAuth2AuthorizationServer.cs
@@ -108,6 +108,10 @@
}
private bool IsAuthorizationValid(HashSet<string> requestedScopes, string clientIdentifier, DateTime issuedUtc, string username) {
+ // If db precision exceeds token time precision (which is common), the following query would
+ // often disregard a token that is minted immediately after the authorization record is stored in the db.
+ // To compensate for this, we'll increase the timestamp on the token's issue date by 1 second.
+ issuedUtc += TimeSpan.FromSeconds(1);
var grantedScopeStrings = from auth in MvcApplication.DataContext.ClientAuthorizations
where
auth.Client.ClientIdentifier == clientIdentifier &&