func getCredential()

in pkg/auth/auth.go [277:299]


func getCredential(secrets map[string]string) (string, string, error) {
	if secrets == nil {
		return "", "", fmt.Errorf("failed to get credentials, nodePublishSecretRef secret is not set")
	}

	var clientID, clientSecret string
	for k, v := range secrets {
		switch strings.ToLower(k) {
		case "clientid":
			clientID = v
		case "clientsecret":
			clientSecret = v
		}
	}

	if clientID == "" {
		return "", "", fmt.Errorf("could not find clientid in secrets")
	}
	if clientSecret == "" {
		return "", "", fmt.Errorf("could not find clientsecret in secrets")
	}
	return clientID, clientSecret, nil
}