From 103dd2ad0b3791796edcd09edd6352ee81b2e59c Mon Sep 17 00:00:00 2001 From: Jose Estrada Date: Fri, 8 Apr 2022 14:37:49 -0700 Subject: [PATCH] aws auth displayName (#14954) * set displayName to include RoleSessionName --- builtin/credential/aws/path_login.go | 5 +++++ changelog/14954.txt | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 changelog/14954.txt diff --git a/builtin/credential/aws/path_login.go b/builtin/credential/aws/path_login.go index 50cdd37d2..fe70de0d0 100644 --- a/builtin/credential/aws/path_login.go +++ b/builtin/credential/aws/path_login.go @@ -1407,6 +1407,11 @@ func (b *backend) pathLoginUpdateIam(ctx context.Context, req *logical.Request, Name: identityAlias, }, } + + if entity.Type == "assumed-role" { + auth.DisplayName = strings.Join([]string{entity.FriendlyName, entity.SessionInfo}, "/") + } + roleEntry.PopulateTokenAuth(auth) if err := identityConfigEntry.IAMAuthMetadataHandler.PopulateDesiredMetadata(auth, map[string]string{ "client_arn": callerID.Arn, diff --git a/changelog/14954.txt b/changelog/14954.txt new file mode 100644 index 000000000..fc8be7056 --- /dev/null +++ b/changelog/14954.txt @@ -0,0 +1,3 @@ +```release-note:change +auth/aws: Add RoleSession to DisplayName when using assumeRole for authentication +``` \ No newline at end of file