|
|
|
@ -145,7 +145,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
if (options.TestCase == "jwt_token_creds") |
|
|
|
|
{ |
|
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
|
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
|
Assert.IsTrue(googleCredential.IsCreateScopedRequired); |
|
|
|
|
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); |
|
|
|
@ -157,7 +157,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
if (options.TestCase == "compute_engine_creds") |
|
|
|
|
{ |
|
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
|
var googleCredential = await GoogleCredential.GetApplicationDefaultAsync(); |
|
|
|
|
Assert.IsFalse(googleCredential.IsCreateScopedRequired); |
|
|
|
|
credentials = ChannelCredentials.Create(credentials, googleCredential.ToCallCredentials()); |
|
|
|
@ -395,7 +395,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) |
|
|
|
|
{ |
|
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
|
Console.WriteLine("running oauth2_auth_token"); |
|
|
|
|
ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); |
|
|
|
|
string oauth2Token = await credential.GetAccessTokenForRequestAsync(); |
|
|
|
@ -421,7 +421,7 @@ namespace Grpc.IntegrationTesting |
|
|
|
|
|
|
|
|
|
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) |
|
|
|
|
{ |
|
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
|
Console.WriteLine("running per_rpc_creds"); |
|
|
|
|
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 |
|
|
|
|
private static string GetEmailFromServiceAccountFile() |
|
|
|
|
{ |
|
|
|
|
#if !NETSTANDARD1_5 |
|
|
|
|
#if !NETCOREAPP1_0 |
|
|
|
|
string keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"); |
|
|
|
|
Assert.IsNotNull(keyFile); |
|
|
|
|
var jobject = JObject.Parse(File.ReadAllText(keyFile)); |
|
|
|
|