func GetAndParseSpiffeID(ctx context.Context) (*config.SpiffeID, error) {
	spiffeID, err := getSpiffeID(ctx)
	if err != nil {
		return nil, err
	}
	id, err := parseSpiffeID(spiffeID)
	return id, err
}
GetAndParseSpiffeID retrieves the SPIFFE Id from the cert and parses it.
package acl
import (
	"context"
	"encoding/asn1"
	"errors"
	"fmt"
	"strings"
	"github.com/PuerkitoBio/purell"
	"google.golang.org/grpc/credentials"
	"google.golang.org/grpc/peer"
	"github.com/dapr/kit/logger"
	"github.com/dapr/dapr/pkg/config"
	diag "github.com/dapr/dapr/pkg/diagnostics"
	commonv1pb "github.com/dapr/dapr/pkg/proto/common/v1"
)
var log = logger.NewLogger("dapr.acl")
func ParseAccessControlSpec(accessControlSpec config.AccessControlSpec, protocol string) (*config.AccessControlList, error) {
	if accessControlSpec.TrustDomain == "" &&
		accessControlSpec.DefaultAction == "" &&
		(accessControlSpec.AppPolicies == nil || len(accessControlSpec.AppPolicies) == 0) {
		log.Debugf("No Access control policy specified")
		return nil, nil
	}
	var accessControlList config.AccessControlList
	accessControlList.PolicySpec = make(map[string]config.AccessControlListPolicySpec)
	accessControlList.DefaultAction = strings.ToLower(accessControlSpec.DefaultAction)
	accessControlList.TrustDomain = accessControlSpec.TrustDomain
	if accessControlSpec.TrustDomain == "" {
		accessControlList.TrustDomain = config.DefaultTrustDomain
	}
	accessControlList.DefaultAction = accessControlSpec.DefaultAction
	if accessControlSpec.DefaultAction == "" {
		if accessControlSpec.AppPolicies == nil || len(accessControlSpec.AppPolicies) > 0 {
			log.Warnf("No global default action has been specified. Setting default global action as Deny")
			accessControlList.DefaultAction = config.DenyAccess
		} else {
			accessControlList.DefaultAction = config.AllowAccess
		}
	}
	var invalidTrustDomain []string
	var invalidNamespace []string
	var invalidAppName bool
	accessControlList.PolicySpec = make(map[string]config.AccessControlListPolicySpec)
	for _, appPolicySpec := range accessControlSpec.AppPolicies {
		invalid := false
		if appPolicySpec.AppName == "" {
			invalidAppName = true
		}
		if appPolicySpec.TrustDomain == "" {
			invalidTrustDomain = append(invalidTrustDomain, appPolicySpec.AppName)
			invalid = true
		}
		if appPolicySpec.Namespace == "" {
			invalidNamespace = append(invalidNamespace, appPolicySpec.AppName)
			invalid = true
		}
		if invalid || invalidAppName {
			continue
		}
		operationPolicy := make(map[string]config.AccessControlListOperationAction)
		for _, appPolicy := range appPolicySpec.AppOperationActions {
			operation := appPolicy.Operation
			if !strings.HasPrefix(operation, "/") {
				operation = "/" + operation
			}
			operationPrefix, operationPostfix := getOperationPrefixAndPostfix(operation)
			if protocol == config.HTTPProtocol {
				operationPrefix = strings.ToLower(operationPrefix)
				operationPostfix = strings.ToLower(operationPostfix)
			}
			operationActions := config.AccessControlListOperationAction{
				OperationPostFix: operationPostfix,
				VerbAction:       make(map[string]string),
			}
			for _, verb := range appPolicy.HTTPVerb {
				operationActions.VerbAction[verb] = appPolicy.Action
			}
			operationActions.OperationAction = appPolicy.Action
			operationPolicy[operationPrefix] = operationActions
		}
		aclPolicySpec := config.AccessControlListPolicySpec{
			AppName:             appPolicySpec.AppName,
			DefaultAction:       appPolicySpec.DefaultAction,
			TrustDomain:         appPolicySpec.TrustDomain,
			Namespace:           appPolicySpec.Namespace,
			AppOperationActions: operationPolicy,
		}
		key := getKeyForAppID(aclPolicySpec.AppName, aclPolicySpec.Namespace)
		accessControlList.PolicySpec[key] = aclPolicySpec
	}
	if len(invalidTrustDomain) > 0 || len(invalidNamespace) > 0 || invalidAppName {
		return nil, fmt.Errorf(
			"invalid access control spec. missing trustdomain for apps: %v, missing namespace for apps: %v, missing app name on at least one of the app policies: %v",
			invalidTrustDomain,
			invalidNamespace,
			invalidAppName)
	}
	return &accessControlList, nil
}