src/server/auth/server/api_server.go
func canonicalizeGitHubUsername(ctx context.Context, user string) (string, error) {
	if strings.Index(user, ":") >= 0 {
		return "", fmt.Errorf("invalid username has multiple prefixes: %s%s", authclient.GitHubPrefix, user)
	}
	if os.Getenv(DisableAuthenticationEnvVar) == "true" {
		// authentication is off -- user might not even be real
		return authclient.GitHubPrefix + user, nil
	}
	gclient := github.NewClient(http.DefaultClient)
	u, _, err := gclient.Users.Get(ctx, strings.ToLower(user))
	if err != nil {
		return "", fmt.Errorf("error canonicalizing \"%s\": %v", user, err)
	}
	return authclient.GitHubPrefix + u.GetLogin(), nil
}
func canonicalizeGitHubUsername(ctx context.Context, user string) (string, error) {
	if strings.Index(user, ":") >= 0 {
		return "", fmt.Errorf("invalid username has multiple prefixes: %s%s", authclient.GitHubPrefix, user)
	}
	if os.Getenv(DisableAuthenticationEnvVar) == "true" {
		// authentication is off -- user might not even be real
		return authclient.GitHubPrefix + user, nil
	}
	gclient := github.NewClient(http.DefaultClient)
	u, _, err := gclient.Users.Get(ctx, strings.ToLower(user))
	if err != nil {
		return "", fmt.Errorf("error canonicalizing \"%s\": %v", user, err)
	}
	return authclient.GitHubPrefix + u.GetLogin(), nil
}
// canonicalizeGitHubUsername corrects 'user' for case errors by looking
// up the corresponding user's GitHub profile and extracting their login ID
// from that. 'user' should not have any subject prefixes (as they are required
// to be a GitHub user).