diff options
Diffstat (limited to 'src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs')
-rw-r--r-- | src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs | 33 |
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 }, }); |