protected virtual Task ValidatePolicyAsync(ConfigurationValidationContext <Client> context) { if (context.Item.Policy == null) { context.SetError($"Policy is required, but no policy is configured."); return(Task.CompletedTask); } ConfigurationValidationContext <Policy> policyContext = new ConfigurationValidationContext <Policy>(context.Item.Policy); _policyConfigurationValidator.ValidateAsync(policyContext); if (!policyContext.IsValid) { context.SetError(policyContext.ErrorMessage); } return(Task.CompletedTask); }
protected virtual Task ValidateRoleAsync(ConfigurationValidationContext <Policy> context) { if (context.Item.Roles.Count == 0) { context.SetError($"At least on Role is required, but no role is configured."); return(Task.CompletedTask); } return(Task.CompletedTask); }
protected virtual Task ValidateCycliqueRoleAsync(ConfigurationValidationContext <Policy> context) { foreach (Role role in context.Item.Roles) { if (!CheckCircularReference(role)) { context.SetError($"Circular reference detected. Please avoid circular references."); return(Task.CompletedTask); } } return(Task.CompletedTask); }