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)
| 296 | // is an email it will add the local part if it's different and the email |
| 297 | // address. |
| 298 | func 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…