func matchSelector()

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


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

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

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

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

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

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

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

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

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

	return matchNotExtends(selector, endpointJSON)
}