Skip to content

Conversation

@robertvoinescu-work
Copy link
Contributor

No description provided.

@robertvoinescu-work robertvoinescu-work changed the title feat: Support credential type parameter for NLog. feat: Support credential type parameter for NLog Nov 21, 2025
This should typically be pulled in as a transitive dependency of GAX, but for now
GAX doesn't reference the latest version.
-->
<PackageReference Include="Google.Apis.Auth" VersionOverride="1.73.0" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Remove before merge, we will rely on the gax transitive dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will just mark this a change request so that we can remember.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generated the new project files. Resolving.

@robertvoinescu-work robertvoinescu-work marked this pull request as ready for review November 21, 2025 18:30
@robertvoinescu-work robertvoinescu-work requested a review from a team as a code owner November 21, 2025 18:30
@amanda-tarafa amanda-tarafa marked this pull request as draft November 21, 2025 21:06
@amanda-tarafa amanda-tarafa added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 21, 2025
@robertvoinescu-work robertvoinescu-work marked this pull request as ready for review November 21, 2025 23:15
@amanda-tarafa amanda-tarafa added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Dec 3, 2025
This should typically be pulled in as a transitive dependency of GAX, but for now
GAX doesn't reference the latest version.
-->
<PackageReference Include="Google.Apis.Auth" VersionOverride="1.73.0" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Will just mark this a change request so that we can remember.

/// Valid strings can be found in the <see cref="JsonCredentialParameters"/> class.
/// Defaults to <see cref="JsonCredentialParameters.ServiceAccountCredentialType"/>.
/// </summary>
public Layout CredentialType { get; set; } = JsonCredentialParameters.ServiceAccountCredentialType;
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if this is set to null? Where do we fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fails at the CredentialFactory in the Google.Apis.Auth layer.

var nullLogEvent = LogEventInfo.CreateNullEvent();
var credentialFile = CredentialFile?.Render(nullLogEvent);
var credentialJson = CredentialJson?.Render(nullLogEvent);
var credentialType = CredentialType?.Render(nullLogEvent);
Copy link
Contributor

Choose a reason for hiding this comment

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

How does the default work? Can this be null even though we have a default, and what happens if it is null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If no value is specified for the key or the key value pair is omitted then the default will be used, but if it is set to an explicit null or the empty string "" then that will be passed forward to the CredentialFactory which will fail.

/// Because ADC resolution depends on the 'GOOGLE_APPLICATION_CREDENTIALS' environment
/// variable—which cannot be securely modified in our test environment.
/// </remarks>
public class CredentialTests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed the corresponding integration tests which validate these cases and moved theme here. On top of this I took the opportunity to test things from the level a config xml is specified and added a couple more test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants