summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-05-27 09:32:17 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2013-05-27 09:32:17 -0700
commit5a0a8ee4c55f323a6c1fbdb619cd89b7d28a94ba (patch)
tree026bb7a58fc6b80b680f2b5be2a25ddf1efbf0f5 /src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
parente4c746826690259eddba106e8a44d1b52b542faf (diff)
parent064220dbab72b00f23abd041bf4a30ea87a00d88 (diff)
downloadDotNetOpenAuth-5a0a8ee4c55f323a6c1fbdb619cd89b7d28a94ba.zip
DotNetOpenAuth-5a0a8ee4c55f323a6c1fbdb619cd89b7d28a94ba.tar.gz
DotNetOpenAuth-5a0a8ee4c55f323a6c1fbdb619cd89b7d28a94ba.tar.bz2
Merge branch 'v4.3'
Conflicts: samples/OAuthClient/Default.aspx samples/OAuthClient/Facebook.aspx.cs samples/OAuthClient/Web.config samples/OAuthClient/WindowsLive.aspx.cs samples/OAuthClient/packages.config src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs src/DotNetOpenAuth.Core/Messaging/StandardWebRequestHandler.cs src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HmacSha1HttpMessageHandler.cs src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1RsaSha1HttpMessageHandler.cs src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs src/packages/repositories.config src/version.txt
Diffstat (limited to 'src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs')
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
index e6642da..5074c0b 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs
@@ -39,21 +39,34 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// </summary>
private readonly string appSecret;
+ /// <summary>
+ /// The requested scopes.
+ /// </summary>
+ private readonly string[] requestedScopes;
+
#endregion
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="MicrosoftClient"/> class.
+ /// Requests a scope of "wl.basic" by default, but "wl.signin" is a good minimal alternative.
/// </summary>
- /// <param name="appId">
- /// The app id.
- /// </param>
- /// <param name="appSecret">
- /// The app secret.
- /// </param>
+ /// <param name="appId">The app id.</param>
+ /// <param name="appSecret">The app secret.</param>
public MicrosoftClient(string appId, string appSecret)
- : this("microsoft", appId, appSecret) {
+ : this(appId, appSecret, "wl.basic")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MicrosoftClient"/> class.
+ /// </summary>
+ /// <param name="appId">The app id.</param>
+ /// <param name="appSecret">The app secret.</param>
+ /// <param name="requestedScopes">One or more requested scopes.</param>
+ public MicrosoftClient(string appId, string appSecret, params string[] requestedScopes)
+ : this("microsoft", appId, appSecret, requestedScopes) {
}
/// <summary>
@@ -62,13 +75,15 @@ namespace DotNetOpenAuth.AspNet.Clients {
/// <param name="providerName">The provider name.</param>
/// <param name="appId">The app id.</param>
/// <param name="appSecret">The app secret.</param>
- protected MicrosoftClient(string providerName, string appId, string appSecret)
+ /// <param name="requestedScopes">One or more requested scopes.</param>
+ protected MicrosoftClient(string providerName, string appId, string appSecret, string[] requestedScopes)
: base(providerName) {
Requires.NotNullOrEmpty(appId, "appId");
Requires.NotNullOrEmpty(appSecret, "appSecret");
this.appId = appId;
this.appSecret = appSecret;
+ this.requestedScopes = requestedScopes;
}
#endregion
@@ -94,7 +109,7 @@ namespace DotNetOpenAuth.AspNet.Clients {
builder.AppendQueryArgs(
new Dictionary<string, string> {
{ "client_id", this.appId },
- { "scope", "wl.basic" },
+ { "scope", string.Join(" ", this.requestedScopes) },
{ "response_type", "code" },
{ "redirect_uri", returnUrl.AbsoluteUri },
});