diff options
Diffstat (limited to 'samples')
5 files changed, 10 insertions, 11 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/InMemoryClientAuthorizationTracker.cs b/samples/DotNetOpenAuth.ApplicationBlock/InMemoryClientAuthorizationTracker.cs index 239b3ac..ef3b686 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/InMemoryClientAuthorizationTracker.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/InMemoryClientAuthorizationTracker.cs @@ -41,12 +41,10 @@ namespace DotNetOpenAuth.ApplicationBlock { #endregion - internal IAuthorizationState NewAuthorization(string scope, out string clientState) { + internal IAuthorizationState NewAuthorization(HashSet<string> scope, out string clientState) { int counter = Interlocked.Increment(ref this.stateCounter); clientState = counter.ToString(CultureInfo.InvariantCulture); - return this.savedStates[counter] = new AuthorizationState { - Scope = scope, - }; + return this.savedStates[counter] = new AuthorizationState(scope); } } #endif diff --git a/samples/OAuthConsumer/SampleWcf2.aspx.cs b/samples/OAuthConsumer/SampleWcf2.aspx.cs index ad569fe..deef073 100644 --- a/samples/OAuthConsumer/SampleWcf2.aspx.cs +++ b/samples/OAuthConsumer/SampleWcf2.aspx.cs @@ -63,9 +63,8 @@ string[] scopes = (from item in this.scopeList.Items.OfType<ListItem>() where item.Selected select item.Value).ToArray(); - string scope = string.Join(" ", scopes); - Client.RequestUserAuthorization(scope).Send(); + Client.RequestUserAuthorization(scopes).Send(); } protected void getNameButton_Click(object sender, EventArgs e) { diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs index d84637e..ae51103 100644 --- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs +++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs @@ -205,7 +205,7 @@ try { var client = new OAuth2.UserAgentClient(authServer, oauth2ClientIdentifierBox.Text, oauth2ClientSecretBox.Text); - var authorization = new AuthorizationState { Scope = oauth2ScopeBox.Text }; + var authorization = new AuthorizationState(OAuthUtilities.SplitScopes(oauth2ScopeBox.Text)); var authorizePopup = new Authorize2(client, authorization); authorizePopup.Owner = this; bool? result = authorizePopup.ShowDialog(); diff --git a/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs b/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs index 41b1d23..3c8a3be 100644 --- a/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs +++ b/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs @@ -83,11 +83,11 @@ OAuth2AuthorizationServer.AsymmetricKey, OAuth2AuthorizationServer.AsymmetricKey)); - string username, scope; + string username; + HashSet<string> scope; var error = resourceServer.VerifyAccess(new HttpRequestInfo(httpDetails, requestUri), out username, out scope); if (error == null) { - string[] scopes = scope.Split(new char[] { ' ' }); - var principal = new OAuthPrincipal(username, scopes); + var principal = new OAuthPrincipal(username, scope.ToArray()); return principal; } else { return null; diff --git a/samples/OAuthServiceProvider/Members/Authorize2.aspx.cs b/samples/OAuthServiceProvider/Members/Authorize2.aspx.cs index 0c14bfd..88c3049 100644 --- a/samples/OAuthServiceProvider/Members/Authorize2.aspx.cs +++ b/samples/OAuthServiceProvider/Members/Authorize2.aspx.cs @@ -8,6 +8,8 @@ using System.Web.UI.WebControls; using Code; + using DotNetOpenAuth.OAuth2; + public partial class Authorize2 : System.Web.UI.Page { private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider(); @@ -22,7 +24,7 @@ Response.Redirect("~/Members/AuthorizedConsumers.aspx"); } else { var pendingRequest = Global.PendingOAuth2Authorization; - this.desiredAccessLabel.Text = pendingRequest.Scope; + this.desiredAccessLabel.Text = OAuthUtilities.JoinScopes(pendingRequest.Scope); this.consumerLabel.Text = pendingRequest.ClientIdentifier; // Generate an unpredictable secret that goes to the user agent and must come back |