Skip to content

Commit

Permalink
Add subscriptionID, resouceGroupName, vmssName and vmName to token me…
Browse files Browse the repository at this point in the history
…tadata (#30)

* Add subscriptionID, resouceGroupName, vmssName and vmName to token metadata

* PR feedback
  • Loading branch information
ungureanuvladvictor authored Feb 26, 2020
1 parent d27d392 commit 9f8a752
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,30 @@ func (b *azureAuthBackend) pathLogin(ctx context.Context, req *logical.Request,
DisplayName: idToken.Subject,
Alias: &logical.Alias{
Name: idToken.Subject,
Metadata: map[string]string{
"resource_group_name": resourceGroupName,
"subscription_id": subscriptionID,
},
},
InternalData: map[string]interface{}{
"role": roleName,
},
Metadata: map[string]string{
"role": roleName,
"role": roleName,
"resource_group_name": resourceGroupName,
"subscription_id": subscriptionID,
},
}

if vmName != "" {
auth.Alias.Metadata["vm_name"] = vmName
auth.Metadata["vm_name"] = vmName
}
if vmssName != "" {
auth.Alias.Metadata["vmss_name"] = vmssName
auth.Metadata["vmss_name"] = vmssName
}

role.PopulateTokenAuth(auth)

resp := &logical.Response{
Expand Down

0 comments on commit 9f8a752

Please sign in to comment.