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

Managed Identity: Support specifying the client ID when requesting a token from the metadata service #115

Merged
merged 2 commits into from
Oct 14, 2021

Conversation

manicminer
Copy link
Owner

@manicminer manicminer commented Oct 12, 2021

Note: breaking change for the auth.NewMsiAuthorizer() and auth.NewMsiConfig() functions

Related: hashicorp/terraform-provider-azuread#604

@manicminer manicminer added enhancement New feature or request breaking change Indicates a non-backwards compatible change package/auth labels Oct 12, 2021
@manicminer manicminer added this to the v0.33.0 milestone Oct 12, 2021
Copy link
Collaborator

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

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

One minor question, but otherwise LGTM 🚀

@@ -31,14 +31,18 @@ func (a *MsiAuthorizer) Token() (*oauth2.Token, error) {
"api-version": []string{a.conf.MsiApiVersion},
"resource": []string{a.conf.Resource},
}

if a.conf.ClientID != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a chance conf can ever be nil here?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good catch, will add checks 👍

Copy link
Collaborator

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

one comment but this otherwise LGTM 👍

@@ -76,13 +80,22 @@ func (a *MsiAuthorizer) Token() (*oauth2.Token, error) {

// MsiConfig configures an MsiAuthorizer.
type MsiConfig struct {
// ClientID is optionally used to determine which application to assume when a resource has multiple managed identities
ClientID string
Copy link
Collaborator

Choose a reason for hiding this comment

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

since this is an optional value I'd suggest this should be a pointer rather than checking != ""?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good shout, this is a pattern used in all the authorizers - will look at improving this

@manicminer manicminer merged commit 58b726a into main Oct 14, 2021
@manicminer manicminer deleted the auth/managed-identity-support-client-id branch October 14, 2021 09:41
manicminer added a commit that referenced this pull request Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Indicates a non-backwards compatible change enhancement New feature or request package/auth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants