-
Notifications
You must be signed in to change notification settings - Fork 480
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
aws auth: add missing auth methods #3597
base: main
Are you sure you want to change the base?
Conversation
return awsRegion, awsAccessKey, awsSecretKey, nil | ||
awsSessionToken, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "AWSSessionToken") | ||
|
||
awsIamRoleArn, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "awsIamRoleArn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awsIamRoleArn, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "awsIamRoleArn") | |
assumeRoleArn, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "assumeRoleArn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cannot be changed, it must match with metadata.yaml , metadata.yaml has been set to match the existing metadata names for the kafka component, so we have consistency
awsSessionToken, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "AWSSessionToken") | ||
|
||
awsIamRoleArn, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "awsIamRoleArn") | ||
awsStsSessionName, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "awsStsSessionName") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awsStsSessionName, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "awsStsSessionName") | |
sessionName, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "sessionName") |
I don't think we need to expose to end users the underlying mechanisms leveraging Sts through which one can assume a new role with new creds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cannot be changed, it must match with metadata.yaml , metadata.yaml has been set to match the existing metadata names for the kafka component, so we have consistency
common/authentication/aws/aws.go
Outdated
@@ -118,40 +119,66 @@ type AWSIAMAuthOptions struct { | |||
Region string `json:"region" mapstructure:"region"` | |||
AccessKey string `json:"accessKey" mapstructure:"accessKey"` | |||
SecretKey string `json:"secretKey" mapstructure:"secretKey"` | |||
SessionToken string `json:"sessionToken" mapstructure:"sessionToken"` | |||
|
|||
AssumeRoleArn string `json:"assumeRoleArn" mapstructure:"assumeRoleArn"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed to change this fields tags, but they are not used for anything
652e3dc
to
c7848a3
Compare
Signed-off-by: Fabian Martinez <[email protected]>
f455abe
to
2a8e733
Compare
Description
Testing AWS IAM auth with postgres and missing the assume role feature that its documented as part of the aws auth profile
It all started because this error check here is bad https://github.com/dapr/components-contrib/blob/main/common/authentication/aws/aws.go#L133
if there is no error,
errors.Is(err, config.SharedConfigAssumeRoleError{}.Err)
always evaluates to true... because when you doconfig.SharedConfigAssumeRoleError{}.Err
thenErr
is nil!I started fixing that but then looking at the kafka pubsub component https://github.com/dapr/components-contrib/blob/main/common/component/kafka/auth.go#L99 , kafka supports more fields, so it made sense to also support these for postgres.
docs updated here dapr/docs#4429
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: