diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-19 07:54:10 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-19 07:54:10 -0700 |
commit | b5c8335f528acbca046ca2844f8e4c12cfa9cba3 (patch) | |
tree | dc1f86b45964c2e4d92a5e61fe0efd317158faf4 /projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs | |
parent | c34d74ed81bcac18961272d52dc5bab21a3394fa (diff) | |
download | DotNetOpenAuth-b5c8335f528acbca046ca2844f8e4c12cfa9cba3.zip DotNetOpenAuth-b5c8335f528acbca046ca2844f8e4c12cfa9cba3.tar.gz DotNetOpenAuth-b5c8335f528acbca046ca2844f8e4c12cfa9cba3.tar.bz2 |
Changed the public API for OAuth 2.0 scope from a space-delimited string to a HashSet<string>
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs b/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs index 2b207f9..3dafa0a 100644 --- a/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs +++ b/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs @@ -145,11 +145,8 @@ namespace RelyingPartyLogic { return false; } - private bool IsAuthorizationValid(string requestedScope, string clientIdentifier, DateTime issuedUtc, string username) + private bool IsAuthorizationValid(HashSet<string> requestedScopes, string clientIdentifier, DateTime issuedUtc, string username) { - var stringCompare = StringComparer.Ordinal; - var requestedScopes = OAuthUtilities.BreakUpScopes(requestedScope, stringCompare); - var grantedScopeStrings = from auth in Database.DataContext.ClientAuthorizations where auth.Client.ClientIdentifier == clientIdentifier && @@ -165,9 +162,9 @@ namespace RelyingPartyLogic { return false; } - var grantedScopes = new HashSet<string>(stringCompare); + var grantedScopes = new HashSet<string>(OAuthUtilities.ScopeStringComparer); foreach (string scope in grantedScopeStrings) { - grantedScopes.UnionWith(OAuthUtilities.BreakUpScopes(scope, stringCompare)); + grantedScopes.UnionWith(OAuthUtilities.SplitScopes(scope)); } return requestedScopes.IsSubsetOf(grantedScopes); |