summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-07-06 06:53:13 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-07-06 06:53:13 -0700
commit9de088f6b539f6d205c01ed405307d59b17fe4f0 (patch)
tree4f64638c49ddbebbf7d9dc04acf1aded3de37a0f /src
parent52a3f817009b1ea7294767b4c045030e138ce170 (diff)
downloadDotNetOpenAuth-9de088f6b539f6d205c01ed405307d59b17fe4f0.zip
DotNetOpenAuth-9de088f6b539f6d205c01ed405307d59b17fe4f0.tar.gz
DotNetOpenAuth-9de088f6b539f6d205c01ed405307d59b17fe4f0.tar.bz2
Got the OAuthConsumerWpf sample working with Facebook OAuth 2.0 again.
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth/Messaging/MessageSerializer.cs4
-rw-r--r--src/DotNetOpenAuth/OAuth2/UserAgentClient.cs27
2 files changed, 20 insertions, 11 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MessageSerializer.cs b/src/DotNetOpenAuth/Messaging/MessageSerializer.cs
index 950791f..d6448ae 100644
--- a/src/DotNetOpenAuth/Messaging/MessageSerializer.cs
+++ b/src/DotNetOpenAuth/Messaging/MessageSerializer.cs
@@ -114,7 +114,7 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="messageDictionary">The message to be serialized.</param>
/// <param name="writer">The writer to use for the serialized form.</param>
/// <remarks>
- /// Use <see cref="System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonWriter"/>
+ /// Use <see cref="System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonWriter(System.IO.Stream)"/>
/// to create the <see cref="XmlDictionaryWriter"/> instance capable of emitting JSON.
/// </remarks>
[Pure]
@@ -186,7 +186,7 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="reader">The XML/JSON to read into the message.</param>
/// <exception cref="ProtocolException">Thrown when protocol rules are broken by the incoming message.</exception>
/// <remarks>
- /// Use <see cref="System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader"/>
+ /// Use <see cref="System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader(System.IO.Stream, System.Xml.XmlDictionaryReaderQuotas)"/>
/// to create the <see cref="XmlDictionaryReader"/> instance capable of reading JSON.
/// </remarks>
internal void Deserialize(MessageDictionary messageDictionary, XmlDictionaryReader reader) {
diff --git a/src/DotNetOpenAuth/OAuth2/UserAgentClient.cs b/src/DotNetOpenAuth/OAuth2/UserAgentClient.cs
index 7815858..621fa97 100644
--- a/src/DotNetOpenAuth/OAuth2/UserAgentClient.cs
+++ b/src/DotNetOpenAuth/OAuth2/UserAgentClient.cs
@@ -22,8 +22,10 @@ namespace DotNetOpenAuth.OAuth2 {
/// Initializes a new instance of the <see cref="UserAgentClient"/> class.
/// </summary>
/// <param name="authorizationServer">The token issuer.</param>
- public UserAgentClient(AuthorizationServerDescription authorizationServer)
- : base(authorizationServer) {
+ /// <param name="clientIdentifier">The client identifier.</param>
+ /// <param name="clientSecret">The client secret.</param>
+ public UserAgentClient(AuthorizationServerDescription authorizationServer, string clientIdentifier = null, string clientSecret = null)
+ : base(authorizationServer, clientIdentifier, clientSecret) {
}
/// <summary>
@@ -39,16 +41,23 @@ namespace DotNetOpenAuth.OAuth2 {
/// Generates a URL that the user's browser can be directed to in order to authorize
/// this client to access protected data at some resource server.
/// </summary>
+ /// <param name="scope">The scope of authorized access requested.</param>
+ /// <returns>A fully-qualified URL suitable to initiate the authorization flow.</returns>
+ public Uri RequestUserAuthoroization(string scope = null) {
+ var authorization = new AuthorizationState { Scope = scope };
+ return this.RequestUserAuthorization(authorization);
+ }
+
+ /// <summary>
+ /// Generates a URL that the user's browser can be directed to in order to authorize
+ /// this client to access protected data at some resource server.
+ /// </summary>
/// <param name="authorization">The authorization state that is tracking this particular request. Optional.</param>
- /// <param name="immediate">If set to <c>true</c>, the authorization server will return immediately instead of interacting with the user. Authorization will only be granted if the authorization server determines it is safe to do so without asking the user first.</param>
/// <returns>A fully-qualified URL suitable to initiate the authorization flow.</returns>
- public Uri RequestUserAuthorization(IAuthorizationState authorization = null) {
+ public Uri RequestUserAuthorization(IAuthorizationState authorization) {
+ Contract.Requires<ArgumentNullException>(authorization != null, "authorization");
Contract.Requires<InvalidOperationException>(!string.IsNullOrEmpty(this.ClientIdentifier));
- if (authorization == null) {
- authorization = new AuthorizationState();
- }
-
if (authorization.Callback == null) {
authorization.Callback = new Uri("http://localhost/");
}
@@ -66,7 +75,7 @@ namespace DotNetOpenAuth.OAuth2 {
/// Scans the incoming request for an authorization response message.
/// </summary>
/// <param name="actualRedirectUrl">The actual URL of the incoming HTTP request.</param>
- /// <param name="authorization">The authorization.</param>
+ /// <param name="authorizationState">The authorization.</param>
/// <returns>The granted authorization, or <c>null</c> if the incoming HTTP request did not contain an authorization server response or authorization was rejected.</returns>
public IAuthorizationState ProcessUserAuthorization(Uri actualRedirectUrl, IAuthorizationState authorizationState = null) {
Contract.Requires<ArgumentNullException>(actualRedirectUrl != null, "actualRedirectUrl");