Package com.denimgroup.threadfix.data.entities

Examples of com.denimgroup.threadfix.data.entities.Application$Info


    String result = checkKey(request, SET_URL);
    if (!result.equals(API_KEY_SUCCESS)) {
      return failure(result);
    }
   
    Application application = applicationService.loadApplication(appId);
   
    if (application == null) {
      log.warn("Invalid Application ID.");
      return failure(APPLICATION_LOOKUP_FAILED);
    } else {
      application.setUrl(url);
      applicationService.storeApplication(application);
            return writeSuccessObjectWithView(application, AllViews.RestViewApplication2_1.class);
    }
  }
View Full Code Here


    if (!result.equals(TASK_KEY_SUCCESS)) {
      return RestResponse.failure(result);
    }
       
    ScanQueueTask myTask = this.scanQueueService.retrieveById(scanQueueTaskId);
    Application taskApp = myTask.getApplication();
   
    //  TODO - Add some checking so you can't just upload any file as the result of a specific scanner's task
    //  For now, passing NULL should force the calculation
    Integer myChannelId = scanTypeCalculationService.calculateScanType(taskApp.getId(), file, null);
   
    try {
      String fileName = scanTypeCalculationService.saveFile(myChannelId, file);
     
      ScanCheckResultBean returnValue = scanService.checkFile(myChannelId, fileName);
View Full Code Here

    public @ResponseBody RestResponse<Map<String, Object>> getHeadingInfo(@PathVariable("appId") Integer appId) {

        Map<String, Object> responseObject = new HashMap<>();

        long numVulns = applicationService.getVulnCount(appId, true);
        Application application = applicationService.loadApplication(appId);
        responseObject.put("scans", application.getScans());
        responseObject.put("numVulns", numVulns);

        return RestResponse.success(responseObject);
    }
View Full Code Here

        String result = checkKey(request, "markers");
        if (!result.equals(API_KEY_SUCCESS)) {
            return RestResponse.failure(result);
        }

        Application application = applicationService.loadApplication(appId);

        if (application == null) {
            String message = "Couldn't find the application with ID " + appId;
            log.warn(message);
            return RestResponse.failure(message);
        }

        List<VulnerabilityMarker> markers = application.getMarkers();

        Collections.sort(markers, new VulnMarkerComparator());

        return RestResponse.success(markers.toArray(new VulnerabilityMarker[markers.size()]));
    }
View Full Code Here

        String result = checkKey(request, "markers");
        if (!result.equals(API_KEY_SUCCESS)) {
            return RestResponse.failure(result);
        }

        Application application = applicationService.loadApplication(appId);
   
    if (application == null) {
            String message = "Couldn't find the application.";
      log.warn(message);
      return RestResponse.failure(message);
View Full Code Here

      @PathVariable("numScans") int numScans,
      Model model) {

    log.info("Hit scan refresh controller.");
   
    Application app = applicationService.loadApplication(appId);
   
    if (app == null || !app.isActive()) {
      log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
      throw new ResourceNotFoundException();
    } else if (app.getScans() != null && app.getScans().size() != numScans) {
      model.addAttribute("contentPage", "/organizations/" + orgId + " /applications/" + appId);
      return "ajaxRedirectHarness";
    } else {
      model.addAttribute("wait", "true");
      return "ajaxJSONHarness";
View Full Code Here

    if (!PermissionUtils.isAuthorized(Permission.READ_ACCESS, orgId, appId)) {
      return writer.writeValueAsString(RestResponse.failure("You are not authorized to view this information."));
    }
   
    Application application = applicationService.loadApplication(appId);
    if (application == null || !application.isActive()) {
      log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
      throw new ResourceNotFoundException();
    }

        long numClosedVulns = applicationService.getVulnCount(appId, false);

    long numVulns = applicationService.getCount(appId, bean);

        TableSortBean falsePositiveBean = new TableSortBean();
        falsePositiveBean.setFalsePositive(true);
        long falsePositiveCount = applicationService.getCount(appId, falsePositiveBean);

        TableSortBean hiddenBean = new TableSortBean();
        hiddenBean.setHidden(true);
        long numHiddenVulns = applicationService.getCount(appId, hiddenBean);

        TableSortBean openBean = new TableSortBean();
        openBean.setOpen(true);
        long numOpenVulns = applicationService.getCount(appId, openBean);

    long numPages = numVulns / 100;
    if (numVulns % 100 == 0) {
      numPages -= 1;
    }
    if (bean.getPage() > numPages) {
      bean.setPage((int) (numPages + 1));
    }
   
    if (bean.getPage() < 1) {
      bean.setPage(1);
    }

    List<Vulnerability> vulnList = applicationService.getVulnTable(appId, bean);

        Map<String, Object> responseMap = new HashMap<>();
        responseMap.put("vulnerabilities", vulnList);
        responseMap.put("numVulns", numVulns);
        responseMap.put("numClosed", numClosedVulns);
        responseMap.put("numHidden", numHiddenVulns);
        responseMap.put("numOpen", numOpenVulns);
        responseMap.put("numFalsePositive", falsePositiveCount);
        responseMap.put("genericVulnerabilities", genericVulnerabilityService.loadAll());
        responseMap.put("scans", application.getScans());

        log.info("Took " + (System.currentTimeMillis() - start) + " ms to generate map objects.");

        return writer.writeValueAsString(RestResponse.success(responseMap));
  }
View Full Code Here

        return true;
    }

    private String createGroupName(ScheduledScan scheduledScan) {
        Application application = scheduledScan.getApplication();
        return application.getOrganization().getName() + "/" + application.getName();
    }
View Full Code Here

   
    if (!PermissionUtils.isAuthorized(Permission.READ_ACCESS, orgId, appId)) {
      return RestResponse.failure("You don't have permission to pull updates from the tracker.");
        }
   
    Application app = applicationService.loadApplication(appId);
   
    if (app == null || app.getOrganization() == null || app.getOrganization().getId() == null) {
      log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
      throw new ResourceNotFoundException();
    }
   
    queueSender.addDefectTrackerVulnUpdate(orgId, appId);
View Full Code Here

        if (!permissionService.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
            return "403";
        }

        Application databaseApplication = applicationService.loadApplication(appId);
        if (databaseApplication == null || !databaseApplication.isActive()) {
            log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
            throw new ResourceNotFoundException();
        }

        // These should not be editable in this method.
        // TODO split into 3 controllers and use setAllowedFields
        application.setWaf(databaseApplication.getWaf());
        application.setDefectTracker(databaseApplication.getDefectTracker());
        application.setUserName(databaseApplication.getUserName());
        application.setPassword(databaseApplication.getPassword());

        if(!result.hasErrors()) {
            applicationService.validateAfterEdit(application, result);
        }
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.entities.Application$Info

Copyright © 2018 www.massapicom. 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.