MCPcopy
hub / github.com/smallstep/cli / createPrincipalsFromSubject

Function createPrincipalsFromSubject

command/ssh/ssh.go:298–311  ·  view source on GitHub ↗

createPrincipalsFromSubject create default principals names for a subject. By default it would be the sanitized version of the subject, but if the subject is an email it will add the local part if it's different and the email address.

(subject string)

Source from the content-addressed store, hash-verified

296// is an email it will add the local part if it's different and the email
297// address.
298func createPrincipalsFromSubject(subject string) []string {
299 name := provisioner.SanitizeSSHUserPrincipal(subject)
300 principals := []string{name}
301 if i := strings.LastIndex(subject, "@"); i >= 0 {
302 if local := subject[:i]; !strings.EqualFold(local, name) {
303 principals = append(principals, local)
304 }
305 }
306 // Append the original subject if different.
307 if subject != name {
308 principals = append(principals, subject)
309 }
310 return principals
311}

Callers 1

certificateActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…