|
|
@ -145,7 +145,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
|
|
if (options.TestCase == "jwt_token_creds") |
|
|
|
if (options.TestCase == "jwt_token_creds") |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
Assert.IsTrue(googleCredential.IsCreateScopedRequired); |
|
|
|
Assert.IsTrue(googleCredential.IsCreateScopedRequired); |
|
|
|
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); |
|
|
|
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); |
|
|
@ -157,7 +157,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
|
|
if (options.TestCase == "compute_engine_creds") |
|
|
|
if (options.TestCase == "compute_engine_creds") |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
Assert.IsFalse(googleCredential.IsCreateScopedRequired); |
|
|
|
Assert.IsFalse(googleCredential.IsCreateScopedRequired); |
|
|
|
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); |
|
|
|
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); |
|
|
@ -395,7 +395,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
|
|
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) |
|
|
|
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
Console.WriteLine("running oauth2_auth_token"); |
|
|
|
Console.WriteLine("running oauth2_auth_token"); |
|
|
|
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); |
|
|
|
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); |
|
|
|
string oauth2Token = await credential.GetAccessTokenForRequestAsync(); |
|
|
|
string oauth2Token = await credential.GetAccessTokenForRequestAsync(); |
|
|
@ -421,7 +421,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
|
|
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) |
|
|
|
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
Console.WriteLine("running per_rpc_creds"); |
|
|
|
Console.WriteLine("running per_rpc_creds"); |
|
|
|
ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
ITokenAccess googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
|
|
|
|
|
|
|
@ -731,7 +731,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
// extracts the client_email field from service account file used for auth test cases |
|
|
|
// extracts the client_email field from service account file used for auth test cases |
|
|
|
private static string GetEmailFromServiceAccountFile() |
|
|
|
private static string GetEmailFromServiceAccountFile() |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"); |
|
|
|
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"); |
|
|
|
Assert.IsNotNull(keyFile); |
|
|
|
Assert.IsNotNull(keyFile); |
|
|
|
var jobject = JObject.Parse(File.ReadAllText(keyFile)); |
|
|
|
var jobject = JObject.Parse(File.ReadAllText(keyFile)); |
|
|
|