Skip to content

Commit

Permalink
feat: try fullname retrieval with lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
aripalo committed May 9, 2022
1 parent f215106 commit f5652ef
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/assumecfg/resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ func getSessionIdentifier() string {
// Let's first try getting user info
if u, err := user.Current(); err == nil {

msg.Debug("🔴", "Fullname:"+u.Name)
if u2, err := user.Lookup(u.Username); err == nil {

msg.Debug("🔴", "uFullname:"+u.Name)
msg.Debug("🔴", "u2Fullname:"+u2.Name)
// Return user full name if meaningful
if len(u2.Name) >= minLength {
msg.Trace("", "Fallback: Fullname")
return u2.Name
}

// Return user full name if meaningful
if len(u.Name) >= minLength {
msg.Trace("", "Fallback: Fullname")
return u.Name
}

// Return user (system) name if meaningful
Expand Down

0 comments on commit f5652ef

Please sign in to comment.