public ValidationResponse validateAnonymousUsername(
     SecurityValidationContext context, String anonymousUsername) {
   // we are not currently doing anything here
   ValidationResponse validationResponse = new ValidationResponse();
   validationResponse.setContext(context);
   return validationResponse;
 }
  public ValidationResponse validateModel(
      SecurityValidationContext context, ValidationRequest<SecurityConfiguration> request) {
    ValidationResponse validationResponse = new ValidationResponse();
    validationResponse.setContext(context);

    SecurityConfiguration configuration = request.getConfiguration();

    validationResponse.append(
        this.validateAnonymousUsername(context, configuration.getAnonymousUsername()));
    validationResponse.append(
        this.validateAnonymousPassword(context, configuration.getAnonymousPassword()));
    validationResponse.append(this.validateRealms(context, configuration.getRealms()));

    return validationResponse;
  }
  public ValidationResponse validateRealms(SecurityValidationContext context, List<String> realms) {
    ValidationResponse validationResponse = new ValidationResponse();
    validationResponse.setContext(context);

    if ((context.getSecurityConfiguration() != null
            && context.getSecurityConfiguration().isEnabled())
        || context.getSecurityConfiguration() == null) {
      if (realms.size() < 1) {
        validationResponse.addValidationError(
            "Security is enabled, You must have at least one realm enabled.");
      }
      // TODO: we should also try to load each one to see if it exists
    }

    return validationResponse;
  }