Examples of Waf


Examples of com.denimgroup.threadfix.data.entities.Waf

            log.warn("Received incomplete REST request to add a WAF");
            return failure(WAF_LOOKUP_FAILED);
        }
   
    Application application = applicationService.loadApplication(appId);
    Waf waf = wafService.loadWaf(wafId);
   
    if (application == null) {
      log.warn(APPLICATION_LOOKUP_FAILED);
      return failure(APPLICATION_LOOKUP_FAILED);
    } else if (waf == null) {
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

                        application.getWaf().getId() == 0)) {
                    databaseApplication.setWaf(null);
                }

                if (application.getWaf() != null && application.getWaf().getId() != null && application.getWaf().getId() != 0) {
                    Waf waf = wafService.loadWaf(application.getWaf().getId());

                    if (waf == null) {
                        result.rejectValue("waf.id", "errors.invalid",
                                new String [] { "WAF Choice" }, null);
                    } else {
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

    return wafService.loadAllWafTypes();
  }

  @RequestMapping(method = RequestMethod.GET)
  public String newForm(Model model) {
    Waf waf = new Waf();
    model.addAttribute(waf);
    return "wafs/form";
  }
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

      return "ajaxFailureHarness";
    } else {
      if (waf.getName().trim().equals("")) {
        result.rejectValue("name", null, null, "This field cannot be blank");
      } else {
        Waf databaseWaf = wafService.loadWaf(waf.getName().trim());
        if (databaseWaf != null) {
          result.rejectValue("name", MessageConstants.ERROR_NAMETAKEN);
        }
      }
     
      if (waf.getWafType() == null) {
        result.rejectValue("wafType.id", MessageConstants.ERROR_REQUIRED, new String [] { "WAF Type" }, null );
            } else if (wafService.loadWafType(waf.getWafType().getId()) == null) {
        result.rejectValue("wafType.id", MessageConstants.ERROR_INVALID, new String [] { waf.getWafType().getId().toString() }, null );
            } else {
        waf.setWafType(wafService.loadWafType(waf.getWafType().getId()));
            }

      if (result.hasErrors()) {
        model.addAttribute("contentPage", "wafs/forms/createWafForm.jsp");
        return "ajaxFailureHarness";
      }
     
      wafService.storeWaf(waf);
     
      String currentUser = SecurityContextHolder.getContext().getAuthentication().getName();
      log.debug(currentUser + " has created a WAF with the name " + waf.getName() +
          ", the type " + waf.getWafType().getName() +
          " and ID " + waf.getId() + ".");
     
      model.addAttribute(wafService.loadAll());
      model.addAttribute("newWaf", new Waf());
      model.addAttribute("waf", new Waf());
      model.addAttribute("wafPage", true);
            PermissionUtils.addPermissions(model, null, null, Permission.CAN_MANAGE_WAFS);

      return "SUCCESS";
    }
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

                        application.getWaf().getId() == 0)) {
                    databaseApplication.setWaf(null);
                }

                if (application.getWaf() != null && application.getWaf().getId() != null && application.getWaf().getId() != 0) {
                    Waf waf = wafService.loadWaf(application.getWaf().getId());

                    if (waf == null) {
                        result.rejectValue("waf.id", "errors.invalid",
                                new String [] { "WAF Choice" }, null);
                    } else {
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

  public List<SecurityEvent> parseInput() {
    if (wafId == null || (fileAsString == null && fileAsMultipartFile == null)) {
      return null;
    }
   
    Waf waf = null;
   
    try {
      Integer intWafId = Integer.valueOf(wafId);
      waf = wafDao.retrieveById(intWafId);
    } catch (NumberFormatException e) {
      log.error("The WAF id given was non-numeric and no WAF could be retrieved. Returning null.");
    }
   
    if (waf == null || waf.getWafType() == null) {
      return null;
    }
   
    WafLogParserFactory factory = new WafLogParserFactory(wafRuleDao, securityEventDao);
    WafLogParser parser = factory.getTracker(waf.getWafType().getName());
    if (parser == null) {
      return null;
    }
   
    parser.setWafId(String.valueOf(wafId));
   
    if (fileAsString != null) {
      parser.setFileAsString(fileAsString);
    } else {
      parser.setFile(fileAsMultipartFile);
    }
   
    log.info("About to parse " + waf.getWafType().getName() + " log file.");
   
    List<SecurityEvent> events = parser.parseInput();
   
    if (events.size() != 0) {
      log.info("Found " + events.size() + " security events in the " + waf.getWafType().getName() + " log.");
    } else {
      log.warn("Found no security events in the " + waf.getWafType().getName() + " log.");
    }
   
    return events;
  }
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

    } else {
     
      if (waf.getName().trim().equals("")) {
        result.rejectValue("name", null, null, "This field cannot be blank");
      } else {
        Waf databaseWaf = wafService.loadWaf(waf.getName().trim());
        if (databaseWaf != null && !databaseWaf.getId().equals(waf.getId())) {
          result.rejectValue("name", MessageConstants.ERROR_NAMETAKEN);
        }
      }
     
      if (waf.getWafType() == null)
View Full Code Here

Examples of com.denimgroup.threadfix.data.entities.Waf

    }
  }
 
  private String index(Model model, String successMessage) {
    model.addAttribute(wafService.loadAll());
    model.addAttribute("newWaf", new Waf());
    model.addAttribute("waf", new Waf());
    model.addAttribute("wafPage", true);
    model.addAttribute("successMessage", successMessage);
        PermissionUtils.addPermissions(model, null, null, Permission.CAN_MANAGE_WAFS);
    model.addAttribute("contentPage", "wafs/wafsTable.jsp");
    return "ajaxSuccessHarness";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.