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

Issue 220770043: Code Review: Adding ApplicationDefaultCredentials to .Net Client Library

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 1 month ago by vsubramani
Modified:
8 years, 11 months ago
Base URL:
https://google-api-dotnet-client.googlecode.com/hg/
Visibility:
Public.

Description

Code Review: Adding ApplicationDefaultCredentials to .Net Client Library

Patch Set 1 #

Total comments: 12

Patch Set 2 : Addressing Jan's comments #

Patch Set 3 : Missed out adding the renamed file Credential.cs #

Total comments: 26

Patch Set 4 : Addressing Anthony's comments #

Total comments: 24

Patch Set 5 : Addressing Anthony's comments - Iteration 2 #

Total comments: 54
Unified diffs Side-by-side diffs Delta from patch set Stats (+451 lines, -14 lines) Patch
M GoogleApisClient.sln View 3 chunks +19 lines, -1 line 2 comments Download
M Src/GoogleApis.Auth.DotNet4/GoogleApis.Auth.DotNet4.csproj View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs View 1 2 3 4 1 chunk +208 lines, -0 lines 34 comments Download
A Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs View 1 2 3 4 1 chunk +54 lines, -0 lines 6 comments Download
M Src/GoogleApis.Auth.DotNet4/OAuth2/ServiceAccountCredential.cs View 1 2 3 4 1 chunk +16 lines, -0 lines 3 comments Download
M Src/GoogleApis.Auth/GoogleApis.Auth.csproj View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Src/GoogleApis.Auth/OAuth2/ComputeCredential.cs View 1 2 3 4 3 chunks +56 lines, -0 lines 6 comments Download
A Src/GoogleApis.Auth/OAuth2/Credential.cs View 1 2 3 4 1 chunk +69 lines, -0 lines 2 comments Download
M Src/GoogleApis.Auth/OAuth2/ServiceCredential.cs View 1 2 3 6 chunks +7 lines, -7 lines 0 comments Download
M Src/GoogleApis.Auth/OAuth2/UserCredential.cs View 1 2 3 4 7 chunks +19 lines, -6 lines 1 comment Download

Messages

Total messages: 19
vsubramani
9 years, 1 month ago (2015-03-17 13:53:14 UTC) #1
jtattermusch
https://codereview.appspot.com/220770043/diff/1/Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs File Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs (right): https://codereview.appspot.com/220770043/diff/1/Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs#newcode49 Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:49: public static GoogleCredential GetApplicationDefaultCredentials(IEnumerable<string> scopes) You are using Credentials ...
9 years, 1 month ago (2015-03-17 15:38:31 UTC) #2
vsubramani
Jan - what tool do you use for the code review comments? The web interface ...
9 years, 1 month ago (2015-03-17 16:09:19 UTC) #3
vsubramani
Addressing Jan's feedback. https://codereview.appspot.com/220770043/diff/1/Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs File Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs (right): https://codereview.appspot.com/220770043/diff/1/Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs#newcode49 Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:49: public static GoogleCredential GetApplicationDefaultCredentials(IEnumerable<string> scopes) On ...
9 years, 1 month ago (2015-03-17 16:36:46 UTC) #4
peleyal
I started to review, and I stopped in the middle. I think we need a ...
9 years, 1 month ago (2015-03-18 14:01:57 UTC) #5
vsubramani
Eyal, I've shared the design details here <https://docs.google.com/a/google.com/document/d/1gKyVT5HFVilL2UMy2e6XsXQ-FL4hwR1QstCAkEljOj8/edit?usp=sharing>. I don't have the data on Compute ...
9 years, 1 month ago (2015-03-18 20:27:58 UTC) #6
peleyal
Can you please give me comment permissions? On Wed, Mar 18, 2015 at 4:27 PM ...
9 years, 1 month ago (2015-03-18 21:51:27 UTC) #7
vsubramani
Done. On Wed, Mar 18, 2015 at 2:51 PM, Eyal Peled <peleyal@google.com> wrote: > Can ...
9 years, 1 month ago (2015-03-18 22:45:50 UTC) #8
Anthony Moore
I was expecting the main entry points to be : GoogleCredential.getApplicationDefault and GoogleCredential.fromStream. Since the ...
9 years, 1 month ago (2015-03-23 22:55:13 UTC) #9
vsubramani
https://codereview.appspot.com/220770043/diff/40001/GoogleApisClient.sln File GoogleApisClient.sln (right): https://codereview.appspot.com/220770043/diff/40001/GoogleApisClient.sln#newcode51 GoogleApisClient.sln:51: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google Compute Sample", "..\..\..\Users\vsubramani\Documents\Visual Studio 2013\Projects\Google Compute ...
9 years, 1 month ago (2015-03-25 00:57:51 UTC) #10
vsubramani
Updated patch sent for review. On Tue, Mar 24, 2015 at 5:57 PM, <vsubramani@google.com> wrote: ...
9 years, 1 month ago (2015-03-25 00:59:10 UTC) #11
Anthony Moore
Good progress. https://codereview.appspot.com/220770043/diff/60001/Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs File Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs (right): https://codereview.appspot.com/220770043/diff/60001/Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs#newcode40 Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs:40: public class GoogleAuth I'd suggest a slightly ...
9 years, 1 month ago (2015-03-25 18:01:59 UTC) #12
vsubramani
https://codereview.appspot.com/220770043/diff/60001/Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs File Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs (right): https://codereview.appspot.com/220770043/diff/60001/Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs#newcode45 Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs:45: const string WELL_KNOWN_CREDENTIALS_FILE = "application_default_credentials.json"; On 2015/03/25 18:01:59, Anthony ...
9 years, 1 month ago (2015-03-25 19:46:37 UTC) #13
Anthony Moore
Looking good. May be a good time to add unit tests. https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs File Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs (right): ...
9 years, 1 month ago (2015-03-26 17:40:03 UTC) #14
peleyal
First comment only on 2-3 files. Rest will come soon https://codereview.appspot.com/220770043/diff/80001/GoogleApisClient.sln File GoogleApisClient.sln (right): https://codereview.appspot.com/220770043/diff/80001/GoogleApisClient.sln#newcode51 ...
9 years ago (2015-04-15 19:57:07 UTC) #15
vsubramani
https://codereview.appspot.com/220770043/diff/80001/GoogleApisClient.sln File GoogleApisClient.sln (right): https://codereview.appspot.com/220770043/diff/80001/GoogleApisClient.sln#newcode51 GoogleApisClient.sln:51: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google Compute Sample", "..\..\..\Users\vsubramani\Documents\Visual Studio 2013\Projects\Google Compute ...
8 years, 11 months ago (2015-05-18 17:31:49 UTC) #16
vsubramani
I am preparing these changes against the github repo. Currently figuring out the github process. ...
8 years, 11 months ago (2015-05-18 18:03:31 UTC) #17
peleyal
Can you please keep uploading to the original thread? Instructions are in: https://developers.google.com/api-client-library/dotnet/contribute Use the ...
8 years, 11 months ago (2015-05-18 21:32:08 UTC) #18
vsubramani
8 years, 11 months ago (2015-05-19 02:03:47 UTC) #19
Eyal, the original CR upload was against the code.google.com repo. Now,
since this has moved to git, I had moved the changes over to git. However
upload.py doesn't seem to like this. It errors out with 'Could not guess
version control system. Are you in a working copy directory?'. While I try
to figure this out and send out the CR through upload.py, is there anyway
you can review the changes at the below git branch?

https://github.com/vsubramani/google-api-dotnet-client/commit/09fa23956c0d64e...


On Mon, May 18, 2015 at 2:32 PM, Eyal Peled <peleyal@google.com> wrote:

> Can you please keep uploading to the original thread? Instructions are in:
> https://developers.google.com/api-client-library/dotnet/contribute
> Use the upload command as following:  upload.py --rev=HEAD -i 220770043
>
> On Mon, May 18, 2015 at 2:03 PM Vijay Subramani <vsubramani@google.com>
> wrote:
>
>> I am preparing these changes against the github repo. Currently figuring
>> out the github process. Expect a github based CR on this in a couple of
>> hours.
>>
>> On Mon, May 18, 2015 at 10:31 AM, <vsubramani@google.com> wrote:
>>
>>>
>>> https://codereview.appspot.com/220770043/diff/80001/GoogleApisClient.sln
>>> File GoogleApisClient.sln (right):
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/GoogleApisClient.sln#newc...
>>> GoogleApisClient.sln:51:
>>> Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google Compute
>>> Sample", "..\..\..\Users\vsubramani\Documents\Visual Studio
>>> 2013\Projects\Google Compute Sample\Google Compute Sample\Google Compute
>>> Sample.csproj", "{8A409FA2-6788-468B-A156-BA91173116DA}"
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> Please revert.
>>>> CAn you also attach somewhere a sample of the final code of the end
>>>>
>>> developer?
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> File Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs
>>> (right):
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:2:
>>> Copyright 2013 Google Inc
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> 2015
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:20:
>>> using System.Threading;
>>> On 2015/04/15 19:57:07, peleyal wrote:
>>>
>>>> Please reorder, first all system ones
>>>> then 3rd parties then Google, as following:
>>>>
>>>
>>>  using System;
>>>> using System.Collections;
>>>> using System.Collections.Generic;
>>>> using System.IO;
>>>> using System.Net;
>>>> using System.Net.Http;
>>>> using System.Threading;
>>>> using System.Threading.Tasks;
>>>>
>>>
>>>  using Newtonsoft.Json;
>>>> using Newtonsoft.Json.Linq;
>>>>
>>>
>>>  using Google.Apis.Auth.OAuth2.Flows;
>>>> using Google.Apis.Auth.OAuth2.Responses;
>>>> using Google.Apis.Http;
>>>> using Google.Apis.Logging;
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:75: lock
>>> (this)
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> It's better to add an object and don't lock this.
>>>> http://stackoverflow.com/questions/251391/why-is-lockthis-bad
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:79:
>>> cachedCredential = GetDefaultCredentialUnsynchronized().Result;
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> I don't recommend using Result at all. Why can't this method use
>>>>
>>> async-await?
>>>
>>> This was based on an earlier comment from Anthony to not expose the
>>> Async pattern on the public surface. I can move it one level up to the
>>> GoogleAuth class, but that wouldn't anything much since this line will
>>> be executed just once in the lifetime of the application domain.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:83: if
>>> (cachedCredential != null)
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> Please add {}
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:93:
>>> private async Task<Credential> GetDefaultCredentialUnsynchronized()
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> I don't understand the flow of this method. Please provide a comment
>>>>
>>> that
>>>
>>>> explain what we except the environment to look like (which files we
>>>>
>>> expecting to
>>>
>>>> have) in each case.
>>>>
>>>
>>> I am not sure I understand what you are looking for? The method already
>>> has comments indicating that it first looks at the file referenced by
>>> the environment variable, then it looks for a well known file location,
>>> failing which it checks whether it is running in compute engine. Was
>>> there more explanation you were expecting?
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:95: //
>>> First try the environment variable
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> Please explain -  environment variable is used on what environment? It
>>>>
>>> is part
>>>
>>>> of the sdk installation? Is it available only on compute?
>>>>
>>>
>>> This is covered by the design doc and the feature documentation. This
>>> environment variable will be set by the developer, if they need to have
>>> explicit control over where the library looks for the credentials file -
>>> this potentially will be useful if the developer runs this code in AWS,
>>> Azure etc. The "How Application Default Credentials Work" section in the
>>> public documentation covers this is a bit more detail -
>>>
>>>
https://developers.google.com/identity/protocols/application-default-credentials
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:107: }
>>> On 2015/03/26 17:40:02, Anthony Moore wrote:
>>>
>>>> Regarding the issue that these two code-paths will return identical
>>>>
>>> exceptions:
>>>
>>>> I do think it is important to have different exception messages, even
>>>>
>>> if we also
>>>
>>>> have a way of detecting this if you opt-in to the logger. The failure
>>>>
>>> paths here
>>>
>>>> are fairly likely to get hit as people go through the getting started
>>>>
>>> experience
>>>
>>>> and we have explicit feedback that more specific exceptions for Auth
>>>>
>>> is
>>>
>>>> important during that experience. For example, if the cause was the
>>>>
>>> environment
>>>
>>>> varialble, the corrective action is to check the value of the
>>>>
>>> variable. If the
>>>
>>>> well-known file is the problem, you may want to delete the file or
>>>>
>>> re-run a
>>>
>>>> gcloud auth login command.
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:111:
>>> ComputeCredential credential = new ComputeCredential();
>>> On 2015/03/26 17:40:02, Anthony Moore wrote:
>>>
>>>> This factoring is better, but there is still the issue that the
>>>>
>>> compute
>>>
>>>> credential is created optimistically and then discarded. Moving that
>>>>
>>> into the if
>>>
>>>> block would improve readability, and decrease fragility over time as
>>>>
>>> this usage
>>>
>>>> assumes there will never be side-effects in the compute credentials
>>>>
>>> constructor.
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:111:
>>> ComputeCredential credential = new ComputeCredential();
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> Weird pattern here. You create a credential and then calling a
>>>>
>>> function on it.
>>>
>>>> Why not having a factory method or something similar?
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:124:
>>> private string GetWellKnownCredentialFilePath()
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> Please add a comment
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:150:
>>> JObject jsonObject = JsonConvert.DeserializeObject<JObject>(await (new
>>> StreamReader(stream)).ReadToEndAsync());
>>> On 2015/04/15 19:57:07, peleyal wrote:
>>>
>>>> Can you please reuse the following method -
>>>>
>>>
>>>
>>>
https://github.com/google/google-api-dotnet-client/blob/master/Src/GoogleApis...
>>> ?
>>>
>>>> If something is missing maybe we should add it and extend client
>>>>
>>> secrets (we can
>>>
>>>> talk about it...)
>>>>
>>>
>>>  I see that you use "type" later on. Is it part of the client secrets
>>>>
>>> file? What
>>>
>>>> spec are you following?
>>>>
>>>
>>> This Credential file format is different from the Client Secrets file
>>> format.
>>>
>>> @Anthony - do you know whether the json file formats for the credentials
>>> are available in public documentation. I searched for it and couldn't
>>> find it. If it really doesn't exist, then lets see where would be the
>>> best place to document it.
>>>
>>> @Eyal - I had identified the file format by downloading it from the dev
>>> console and opening it :)
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:163: {
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> what is this type of file? How do we get it?
>>>>
>>>
>>> This would be auto generated by the gcloud sdk when the developer runs
>>> 'gcloud auth login'
>>>
>>> Added comment to the code to reflect this.
>>>
>>> Also done the same for the Service Account File case below.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/DefaultCredentialProvider.cs:186:
>>> catch(IOException e)
>>> On 2015/04/15 19:57:06, peleyal wrote:
>>>
>>>> space between catch and (
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> File Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs (right):
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs:40: public class
>>> GoogleAuth
>>> On 2015/03/26 17:40:02, Anthony Moore wrote:
>>>
>>>> Suggest "public static class GoogleAuth". It will clarify that this is
>>>>
>>> just for
>>>
>>>> static methods.
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs:40: public class
>>> GoogleAuth
>>> On 2015/04/15 19:57:07, peleyal wrote:
>>>
>>>> Why do we need this class? Why DefaultCredentialProvider isn't enough?
>>>>
>>>
>>> The DefaultCredentialProvider is not public. It is meant for internal
>>> testability (which is yet to be added though).
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleAuth.cs:44: public static
>>> Credential GetApplicationDefaultCredential()
>>> On 2015/03/26 17:40:02, Anthony Moore wrote:
>>>
>>>> I'd suggest at least a minimal doc-comment for these 2 methods. It
>>>>
>>> looks like
>>>
>>>> this practice is inconsistent in this library so far, but these 2 are
>>>>
>>> important
>>>
>>>> entry points and at least the top-line pops up in intellisense in
>>>>
>>> Visual Studio,
>>>
>>>> and it would be good to make this a standard practise for new public
>>>>
>>> methods as
>>>
>>>> it is in the other langauges.
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> File Src/GoogleApis.Auth.DotNet4/OAuth2/ServiceAccountCredential.cs
>>> (right):
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth.DotNe...
>>> Src/GoogleApis.Auth.DotNet4/OAuth2/ServiceAccountCredential.cs:217:
>>> public bool IsCreateScopedRequired { get { return true; } }
>>> On 2015/03/26 17:40:02, Anthony Moore wrote:
>>>
>>>> As long as this is not implemented, I would leave this false.
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth/OAuth...
>>> File Src/GoogleApis.Auth/OAuth2/ComputeCredential.cs (right):
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth/OAuth...
>>> Src/GoogleApis.Auth/OAuth2/ComputeCredential.cs:121: if
>>> (!response.Headers.TryGetValues("Metadata-Flavor", out headerValues))
>>> On 2015/03/26 17:40:03, Anthony Moore wrote:
>>>
>>>> The logger warning below is great because this would be a genuinely
>>>>
>>> unusual
>>>
>>>> condition. It would be good to fall into it in both the case where the
>>>>
>>> header
>>>
>>>> value is missing and when it has the wrong value. Consider switching
>>>>
>>> this to
>>>
>>>> something like:
>>>>
>>>
>>>  if (response.Headers.TryGetValues("Metadata-Flavor", out
>>>>
>>> headerValues)) {
>>>
>>>>    foreach (var value in headerValues)
>>>>    {
>>>>      if (value == "Google")
>>>>        return true;
>>>>    }
>>>> }
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth/OAuth...
>>> Src/GoogleApis.Auth/OAuth2/ComputeCredential.cs:135:
>>> Logger.Warning(String.Format("Could not reach the ComputeEngine Metadata
>>> service. Obtained HttpRequestException {0}", e.Message));
>>> On 2015/03/26 17:40:03, Anthony Moore wrote:
>>>
>>>> Of the logger warnings here, I think that this one should perhaps be
>>>>
>>> removed.
>>>
>>>> It's an non-error condition running off GCE.
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth/OAuth...
>>> Src/GoogleApis.Auth/OAuth2/ComputeCredential.cs:154: + " Hence returning
>>> the same object.");
>>> On 2015/03/26 17:40:03, Anthony Moore wrote:
>>>
>>>> This is a really good log message. Some tweaks might be that I think
>>>>
>>> we could
>>>
>>>> remove the "Hence returning.." sentance and perhapcs suggest to check
>>>> IsCreateScopedRequired to turn this off.
>>>>
>>>
>>> Acknowledged.
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth/OAuth...
>>> File Src/GoogleApis.Auth/OAuth2/Credential.cs (right):
>>>
>>>
>>>
https://codereview.appspot.com/220770043/diff/80001/Src/GoogleApis.Auth/OAuth...
>>> Src/GoogleApis.Auth/OAuth2/Credential.cs:66: public abstract
>>> Task<Credential> CreateScoped(IEnumerable<string> scopes);
>>> On 2015/03/26 17:40:03, Anthony Moore wrote:
>>>
>>>> I's suggest a default implementation of "return this" also.
>>>>
>>>
>>> Acknowledged.
>>>
>>> https://codereview.appspot.com/220770043/
>>>
>>
>>
Sign in to reply to this message.

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