// User represents a user returned from AuthenticatorService
typeUserstruct{
Usernamestring`json:"username"`
Namestring`json:"name"`
Surnamestring`json:"surname"`
// FullName is a separate field from Name and Surname because for example
// ldap stores them all as separate fields.
FullNamestring`json:"fullName"`
Emailstring`json:"email"`
}
// WithDefaultFullName is a utility that returns a copy of the given user with the full name set to the concatenation of the name and surname of the user.
func(uUser)WithDefaultFullName()User{
returnUser{
Username:u.Username,
Name:u.Name,
Surname:u.Surname,
Email:u.Email,
FullName:u.Username+" "+u.Surname,
}
}
// Session represents a session returned from AuthenticatorService