Skip to content
Snippets Groups Projects
Commit 9490daf6 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

remove Google.Apis.Auth related CoreCLR todos

parent a6624bb0
No related branches found
No related tags found
No related merge requests found
...@@ -145,26 +145,16 @@ namespace Grpc.IntegrationTesting ...@@ -145,26 +145,16 @@ namespace Grpc.IntegrationTesting
if (options.TestCase == "jwt_token_creds") if (options.TestCase == "jwt_token_creds")
{ {
#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());
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
if (options.TestCase == "compute_engine_creds") if (options.TestCase == "compute_engine_creds")
{ {
#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());
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
return credentials; return credentials;
} }
...@@ -395,7 +385,6 @@ namespace Grpc.IntegrationTesting ...@@ -395,7 +385,6 @@ namespace Grpc.IntegrationTesting
public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunOAuth2AuthTokenAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#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();
...@@ -413,15 +402,10 @@ namespace Grpc.IntegrationTesting ...@@ -413,15 +402,10 @@ namespace Grpc.IntegrationTesting
Assert.True(oauthScope.Contains(response.OauthScope)); Assert.True(oauthScope.Contains(response.OauthScope));
Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username); Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username);
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope) public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string oauthScope)
{ {
#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();
...@@ -435,10 +419,6 @@ namespace Grpc.IntegrationTesting ...@@ -435,10 +419,6 @@ namespace Grpc.IntegrationTesting
Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username); Assert.AreEqual(GetEmailFromServiceAccountFile(), response.Username);
Console.WriteLine("Passed!"); Console.WriteLine("Passed!");
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
public static async Task RunCancelAfterBeginAsync(TestService.TestServiceClient client) public static async Task RunCancelAfterBeginAsync(TestService.TestServiceClient client)
...@@ -731,17 +711,12 @@ namespace Grpc.IntegrationTesting ...@@ -731,17 +711,12 @@ 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 !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));
string email = jobject.GetValue("client_email").Value<string>(); string email = jobject.GetValue("client_email").Value<string>();
Assert.IsTrue(email.Length > 0); // spec requires nonempty client email. Assert.IsTrue(email.Length > 0); // spec requires nonempty client email.
return email; return email;
#else
// TODO(jtattermusch): implement this
throw new NotImplementedException("Not supported on CoreCLR yet");
#endif
} }
private static Metadata CreateTestMetadata() private static Metadata CreateTestMetadata()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment