Skip to content

Commit

Permalink
bugfix: oidc should not be used when required fields are missing (#536)
Browse files Browse the repository at this point in the history
* bugfix: when oidc failed, the provider should try other auth methods

* Revert "bugfix: when oidc failed, the provider should try other auth methods"

This reverts commit cf4bc7b.

* bugfix: oidc should not be used when required fields are missing

* Update internal/provider/provider.go

Co-authored-by: Zhenhua Hu <[email protected]>

---------

Co-authored-by: Zhenhua Hu <[email protected]>
  • Loading branch information
ms-henglu and ms-zhenhua authored Jun 24, 2024
1 parent e918063 commit 3f70d44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ BUG FIXES:
- Fix a bug that `azapi_resource` will crash when the `location` in GET response is null.
- Fix a bug that schema validation fails to validate unknown string values.
- Fix a bug that `azapi_resource` only supports extension resource on a resource group scoped resource.
- Fix a bug that OIDC authentication should not be used when required fields are missing.

## v1.13.1

Expand Down
3 changes: 3 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,9 @@ func buildOidcCredential(model providerData, options azidentity.DefaultAzureCred
if err != nil {
return nil, err
}
if model.OIDCToken.ValueString() == "" && model.GetOIDCTokenFilePath() == "" && (model.OIDCRequestToken.ValueString() == "" || model.OIDCRequestURL.ValueString() == "") {
return nil, fmt.Errorf("missing required OIDC configuration")
}
o := &OidcCredentialOptions{
ClientOptions: azcore.ClientOptions{
Cloud: options.Cloud,
Expand Down

0 comments on commit 3f70d44

Please sign in to comment.