Skip to content

Commit

Permalink
Updated Resource id parameter
Browse files Browse the repository at this point in the history
Updated the resource Id parameter for every source except IMDS
  • Loading branch information
4gust committed Dec 31, 2024
1 parent 5aed02f commit 549b2b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions apps/managedidentity/managedidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const (
// UAMI query parameter name
miQueryParameterClientId = "client_id"
miQueryParameterObjectId = "object_id"
miQueryParameterResourceId = "msi_res_id"
miQueryParameterResourceIdIMDS = "msi_res_id"
miQueryParameterResourceId = "mi_res_id"

// IMDS
imdsDefaultEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token"
Expand Down Expand Up @@ -504,7 +505,7 @@ func createIMDSAuthRequest(ctx context.Context, id ID, resource string, c Client
case UserAssignedClientID:
msiParameters.Set(miQueryParameterClientId, string(t))
case UserAssignedResourceID:
msiParameters.Set(miQueryParameterResourceId, string(t))
msiParameters.Set(miQueryParameterResourceIdIMDS, string(t))
case UserAssignedObjectID:
msiParameters.Set(miQueryParameterObjectId, string(t))
case systemAssignedValue: // not adding anything
Expand Down
4 changes: 2 additions & 2 deletions apps/managedidentity/managedidentity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ func TestIMDSAcquireTokenReturnsTokenSuccess(t *testing.T) {
t.Fatalf("resource client-id is incorrect, wanted %s got %s", i.value(), query.Get(miQueryParameterClientId))
}
case UserAssignedResourceID:
if query.Get(miQueryParameterResourceId) != i.value() {
t.Fatalf("resource resource-id is incorrect, wanted %s got %s", i.value(), query.Get(miQueryParameterResourceId))
if query.Get(miQueryParameterResourceIdIMDS) != i.value() {
t.Fatalf("resource resource-id is incorrect, wanted %s got %s", i.value(), query.Get(miQueryParameterResourceIdIMDS))
}
case UserAssignedObjectID:
if query.Get(miQueryParameterObjectId) != i.value() {
Expand Down

0 comments on commit 549b2b0

Please sign in to comment.