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

Fix aws_msk_iam_v2 module Authentication failure bug #977

Merged

Conversation

kikyomits
Copy link
Contributor

Use CredentialsProvider instead of static Credentials. See #976

@kikyomits kikyomits force-pushed the fix/msk-iam-v2-token-expiration branch from 0aae3eb to 264bc93 Compare August 30, 2022 23:46
@achille-roussel achille-roussel self-assigned this Sep 2, 2022
Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

Thanks for submitting the contribution!

I left a few comments, let me know if you have concerns about any of the suggestions!

// The aws.Credentials of aws-sdk-go-v2. Required.
Credentials aws.Credentials
// The aws.CredentialsProvider of aws-sdk-go-v2. Required.
CredentialsProvider aws.CredentialsProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

Credentials is shorter and clearly communicates the purpose, and the type information already expresses that we expect a provider; how about keeping the original field name?

It's also the name used in the aws.Config type, so it would remain consistent.

Comment on lines 175 to 179
sig := signer.NewSigner()
return &Mechanism{
Signer: sig,
CredentialsProvider: awsCfg.Credentials,
Region: awsCfg.Region,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we could do without the intermediary variable here?

Suggested change
sig := signer.NewSigner()
return &Mechanism{
Signer: sig,
CredentialsProvider: awsCfg.Credentials,
Region: awsCfg.Region,
}
return &Mechanism{
Signer: signer.NewSigner(),
CredentialsProvider: awsCfg.Credentials,
Region: awsCfg.Region,
}

@@ -32,15 +32,15 @@ const (
queryExpiryKey = "X-Amz-Expires"
)

var signUserAgent = fmt.Sprintf("kafka-go/sasl/aws_msk_iam/%s", runtime.Version())
var signUserAgent = fmt.Sprintf("kafka-go/sasl/aws_msk_iam_v2/%s", runtime.Version())
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor and unrelated to your change, but since it's being modified. This could be a simpler way to express the concatenation:

Suggested change
var signUserAgent = fmt.Sprintf("kafka-go/sasl/aws_msk_iam_v2/%s", runtime.Version())
var signUserAgent = "kafka-go/sasl/aws_msk_iam_v2/" + runtime.Version()

@kikyomits kikyomits force-pushed the fix/msk-iam-v2-token-expiration branch 2 times, most recently from 0cd64d8 to 54fe6c1 Compare September 3, 2022 14:58
@kikyomits
Copy link
Contributor Author

kikyomits commented Sep 3, 2022

@achille-roussel thanks, I have reflected your comments. Would you mind to tell me how to re-trigger the CI pipeline?
One of the test is intermittently failed and I'm a bit reluctant to make (amend) commit just for re-run the job.

Do we have a way to rerun the CI job from PR comment like /run-ci ?

Use `CredentialsProvider` instead of static `Credentials`. See segmentio#976
@kikyomits kikyomits force-pushed the fix/msk-iam-v2-token-expiration branch from 54fe6c1 to 4455e21 Compare September 10, 2022 15:12
@kikyomits
Copy link
Contributor Author

hi @achille-roussel , I have re-ran the CI and confirmed it passed all checks. Can you please review this?

Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

Looking great, thanks for the contribution!

@achille-roussel achille-roussel merged commit e6e882d into segmentio:main Sep 12, 2022
@kikyomits
Copy link
Contributor Author

Thanks for the review! Pleasure to contribute to this great project.

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.

2 participants