func matchSelector()

in pkg/authority/rule/authorization/rule.go [97:137]


func matchSelector(target *Target, endpoint *rule.Endpoint) bool {
	if endpoint == nil {
		return true
	}

	if !matchNamespace(target, endpoint) {
		return false
	}

	if !matchNotNamespace(target, endpoint) {
		return false
	}

	if !matchIPBlocks(target, endpoint) {
		return false
	}

	if !matchNotIPBlocks(target, endpoint) {
		return false
	}

	if !matchPrincipals(target, endpoint) {
		return false
	}

	if !matchNotPrincipals(target, endpoint) {
		return false
	}

	endpointJSON, err := json.Marshal(endpoint)
	if err != nil {
		logger.Sugar().Warnf("marshal endpoint failed, %v", err)
		return false
	}

	if !matchExtends(target, endpointJSON) {
		return false
	}

	return matchNotExtends(target, endpointJSON)
}