コード例 #1
0
  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;
  }
  @SuppressWarnings("unchecked")
  public ValidationResponse validateModel(final ValidationRequest request) {
    final ValidationResponse response = new ValidationResponse();

    final Configuration configuration = (Configuration) request.getConfiguration();

    if (configuration == null) {
      final ValidationMessage msg =
          new ValidationMessage("*", "No configuration available to validate");

      response.addValidationError(msg);
    } else {
      for (final CCapability capability : configuration.getCapabilities()) {
        response.append(validate(capability, false));
      }
    }

    return response;
  }