Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credential improvements #1077

Merged
merged 2 commits into from
Aug 30, 2017
Merged

Credential improvements #1077

merged 2 commits into from
Aug 30, 2017

Conversation

chrisdunelm
Copy link
Contributor

Create credentials from file path; and allow scopes to be specified in all relevant credential static factory methods.

If this looks OK, I'll add xmldocs.

Helps with googleapis/google-cloud-dotnet#1398

Create credentials from file path; and allow scopes to be specified in all relevant credential static factory methods.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 24, 2017
@chrisdunelm
Copy link
Contributor Author

/cc @SurferJeffAtGoogle

@chrisdunelm
Copy link
Contributor Author

@jskeet Please check especially for backward compatibility.

Copy link
Collaborator

@jskeet jskeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely happy with FromFile. Not sure about the scoping parts... maybe see what @SurferJeffAtGoogle thinks?

{
return defaultCredentialProvider.GetDefaultCredentialAsync();
}
public static async Task<GoogleCredential> GetApplicationDefaultAsync(IEnumerable<string> scopes) =>

This comment was marked as spam.

This comment was marked as spam.

{
return defaultCredentialProvider.CreateDefaultCredentialFromStream(stream);
using (var f = File.OpenRead(path))

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor Author

@chrisdunelm chrisdunelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the scoping part is useful, as it shows that it's important to think about scopes. Currently it's very easy to miss them completely.
Although I agree that as they're only relevant with Service Credentials, it may be that most users don't ever need to think about them!

{
return defaultCredentialProvider.GetDefaultCredentialAsync();
}
public static async Task<GoogleCredential> GetApplicationDefaultAsync(IEnumerable<string> scopes) =>

This comment was marked as spam.

{
return defaultCredentialProvider.CreateDefaultCredentialFromStream(stream);
using (var f = File.OpenRead(path))

This comment was marked as spam.

@chrisdunelm
Copy link
Contributor Author

Yes, let's see what @SurferJeffAtGoogle thinks.

public static GoogleCredential FromStream(Stream stream, string scope1, params string[] scopes) =>
FromStream(stream, new[] { scope1.ThrowIfNull(nameof(scope1)) }.Concat(scopes.ThrowIfNull(nameof(scopes))));

public static GoogleCredential FromFile(string path, IEnumerable<string> scopes)

This comment was marked as spam.


public static Task<GoogleCredential> GetApplicationDefaultAsync() => GetApplicationDefaultAsync(Enumerable.Empty<string>());

public static Task<GoogleCredential> GetApplicationDefaultAsync(string scope1, params string[] scopes) =>

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@chrisdunelm chrisdunelm merged commit ebe737d into googleapis:master Aug 30, 2017
@chrisdunelm chrisdunelm deleted the cred branch March 16, 2018 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants