Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(500)

Unified Diff: Src/GoogleApis.Authentication.OAuth2/OAuth2Authenticator.cs

Issue 13412046: Reimplement OAuth2 library - Step 1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Src/GoogleApis.Authentication.OAuth2/OAuth2Authenticator.cs
===================================================================
--- a/Src/GoogleApis.Authentication.OAuth2/OAuth2Authenticator.cs
b/Src/GoogleApis.Authentication.OAuth2/OAuth2Authenticator.cs
@@ -17,6 17,7 @@
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using DotNetOpenAuth.OAuth2;
@@ -34,9 35,7 @@
private readonly TClient tokenProvider;
private bool noCaching;
- /// <summary>
- /// Creates a new OAuth2 authenticator.
- /// </summary>
/// <summary>Creates a new OAuth2 authenticator.</summary>
/// <param name="tokenProvider">The client which is used for requesting access and refresh tokens.</param>
/// <param name="authProvider">The method which provides the initial authorization for the provider.</param>
public OAuth2Authenticator(TClient tokenProvider,
@@ -49,9 48,7 @@
this.authProvider = authProvider;
}
- /// <summary>
- /// The current state of this authenticator
- /// </summary>
/// <summary>The current state of this authenticator.</summary>
public IAuthorizationState State { get; private set; }
/// <summary>
@@ -125,11 122,16 @@
}
/// <summary>
- /// Override handle response to refresh the token when Unauthorized status code is received.
/// Overrides handle response to refresh the token when Unauthorized status code is received.
/// </summary>
- public bool HandleResponse(HandleUnsuccessfulResponseArgs args)
public Task<bool> HandleResponseAsync(HandleUnsuccessfulResponseArgs args)
{
- return args.Response.StatusCode == HttpStatusCode.Unauthorized && tokenProvider.RefreshToken(State, null);
var result = args.Response.StatusCode == HttpStatusCode.Unauthorized &&
tokenProvider.RefreshToken(State, null);
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
tcs.SetResult(result);
return tcs.Task;
}
}
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b