Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added config.NewAzureCliTokenSource and config.NewAzureMsiTokenSource constructors #727

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Dec 1, 2023

Changes

This PR exposes Azure CLI and Azure MSI token sources, that can be used externally to authenticate to services like Azure Resource Manager and Microsoft Graph, but still staying within the same testing ecosystem and without any extra dependencies.

Tests

  • make test passing
  • make fmt applied
  • relevant integration tests applied

…rce` helpers

This PR exposes Azure CLI and Azure MSI token sources, that can be used externally to authenticate to services like Azure Resource Manager and Microsoft Graph, but still staying within the same testing ecosystem and without any extra dependences.
@nfx nfx requested a review from mgyucht December 1, 2023 20:04
@nfx nfx enabled auto-merge December 1, 2023 20:06
@codecov-commenter
Copy link

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (82d089a) 17.57% compared to head (fe55e62) 17.58%.

Files Patch % Lines
config/auth_azure_cli.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #727   +/-   ##
=======================================
  Coverage   17.57%   17.58%           
=======================================
  Files         103      103           
  Lines       14188    14191    +3     
=======================================
+ Hits         2494     2495    +1     
- Misses      11489    11491    +2     
  Partials      205      205           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nfx nfx added this pull request to the merge queue Dec 4, 2023
Merged via the queue into main with commit 964cdc1 Dec 4, 2023
4 checks passed
@nfx nfx deleted the expose/aad-token-sources branch December 4, 2023 07:54
mgyucht added a commit that referenced this pull request Dec 7, 2023
This is a bugfix release, including a fix correcting issues with OAuth flows, due to a bug with the propagation of the response status in `httpclient`'s `RoundTrip()` implementation. This fixes the `failed during request visitor: token: oauth2: cannot fetch token: Response: {...}` error.

All fixes:

* Migrate Azure MSI & Metadata Service token sources to `httpclient` and add 100% test coverage ([#709](#709)).
* Added `config.NewAzureCliTokenSource` and `config.NewAzureMsiTokenSource` constructors ([#727](#727)).
* Use per-config refresh context for OAuth tokens ([#728](#728)).
@mgyucht mgyucht mentioned this pull request Dec 7, 2023
github-merge-queue bot pushed a commit that referenced this pull request Dec 7, 2023
This is a bugfix release, including a fix correcting issues with OAuth
flows, due to a bug with the propagation of the response status in
`httpclient`'s `RoundTrip()` implementation. This fixes the `failed
during request visitor: token: oauth2: cannot fetch token: Response:
{...}` error.

All fixes:

* Migrate Azure MSI & Metadata Service token sources to `httpclient` and
add 100% test coverage
([#709](#709)).
* Added `config.NewAzureCliTokenSource` and
`config.NewAzureMsiTokenSource` constructors
([#727](#727)).
* Use per-config refresh context for OAuth tokens
([#728](#728)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants