diff options
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2.Client/OAuth2')
4 files changed, 16 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs index 6911452..8a681be 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs @@ -44,7 +44,7 @@ namespace DotNetOpenAuth.OAuth2 { /// Gets the OAuth channel. /// </summary> /// <value>The channel.</value> - public Channel Channel { get; private set; } + public Channel Channel { get; internal set; } /// <summary> /// Gets or sets the identifier by which this client is known to the Authorization Server. diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.Designer.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.Designer.cs index 72701d3..d140b7e 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.Designer.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.Designer.cs @@ -86,5 +86,14 @@ namespace DotNetOpenAuth.OAuth2 { return ResourceManager.GetString("AuthorizationResponseUnexpectedMismatch", resourceCulture); } } + + /// <summary> + /// Looks up a localized string similar to The property {0} must be set before this operation is allowed.. + /// </summary> + internal static string RequiredPropertyNotYetPreset { + get { + return ResourceManager.GetString("RequiredPropertyNotYetPreset", resourceCulture); + } + } } } diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.resx b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.resx index a78e397..114b3e8 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.resx +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/OAuth2Strings.resx @@ -126,4 +126,7 @@ <data name="AuthorizationResponseUnexpectedMismatch" xml:space="preserve"> <value>Unexpected OAuth authorization response received with callback and client state that does not match an expected value.</value> </data> + <data name="RequiredPropertyNotYetPreset" xml:space="preserve"> + <value>The property {0} must be set before this operation is allowed.</value> + </data> </root>
\ No newline at end of file diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs index 09f471c..ffcc1ee 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs @@ -71,7 +71,7 @@ namespace DotNetOpenAuth.OAuth2 { public OutgoingWebResponse PrepareRequestUserAuthorization(IAuthorizationState authorization, string state = null) { Requires.NotNull(authorization, "authorization"); Requires.ValidState(authorization.Callback != null || (HttpContext.Current != null && HttpContext.Current.Request != null), MessagingStrings.HttpContextRequired); - Requires.ValidState(!string.IsNullOrEmpty(this.ClientIdentifier)); + Requires.ValidState(!string.IsNullOrEmpty(this.ClientIdentifier), OAuth2Strings.RequiredPropertyNotYetPreset, "ClientIdentifier"); Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); if (authorization.Callback == null) { @@ -97,8 +97,8 @@ namespace DotNetOpenAuth.OAuth2 { /// <param name="request">The incoming HTTP request that may carry an authorization response.</param> /// <returns>The authorization state that contains the details of the authorization.</returns> public IAuthorizationState ProcessUserAuthorization(HttpRequestInfo request = null) { - Requires.ValidState(!string.IsNullOrEmpty(this.ClientIdentifier)); - Requires.ValidState(!string.IsNullOrEmpty(this.ClientSecret)); + Requires.ValidState(!string.IsNullOrEmpty(this.ClientIdentifier), OAuth2Strings.RequiredPropertyNotYetPreset, "ClientIdentifier"); + Requires.ValidState(!string.IsNullOrEmpty(this.ClientSecret), OAuth2Strings.RequiredPropertyNotYetPreset, "ClientSecret"); if (request == null) { request = this.Channel.GetRequestFromContext(); |