Skip to content

Commit

Permalink
SNOW-937188 fixes for KeyPairAuth params validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mhofman committed May 9, 2024
1 parent 04633e2 commit caf1eed
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ public static void Validate(SFSessionProperties properties)
valid = true;
break;
case KeyPairAuthenticator.AUTH_NAME:
valid = !string.IsNullOrEmpty(properties[SFSessionProperty.PRIVATE_KEY]) ||
!string.IsNullOrEmpty(properties[SFSessionProperty.PRIVATE_KEY]);
valid = (properties.TryGetValue(SFSessionProperty.PRIVATE_KEY, out var privateKey)
&& !string.IsNullOrEmpty(privateKey)) ||
(properties.TryGetValue(SFSessionProperty.PRIVATE_KEY_FILE, out var privateKeyFile) &&
!string.IsNullOrEmpty(privateKeyFile));
if (!valid)
error = $"PRIVATE_KEY or PRIVATE_KEY should be provided for Authenticator={authenticator}";
error = $"PRIVATE_KEY or PRIVATE_KEY_FILE should be provided for Authenticator={authenticator}";
break;
case OAuthAuthenticator.AUTH_NAME:
valid = !string.IsNullOrEmpty(properties[SFSessionProperty.TOKEN]);
Expand Down

0 comments on commit caf1eed

Please sign in to comment.