Interface EnterpriseClient

    • Method Detail

      • getUrl

        String getUrl()
        returns the full URL for the enterprise rest endpoint
        Returns:
        the full URL for the enterprise rest endpoint
      • login

        Optional<String> login​(AuthenticationModel authModel)
        calls the /Authentication/Login endpoint with provided details
        Parameters:
        authModel - authentication details such as username, password and optionally clientId
        Returns:
        on success Optional containing the authorization token; otherwise empty
      • testAuthentication

        boolean testAuthentication​(AuthenticationModel authModel)
        calls the /Authentication/Login endpoint with provided details returning true if credentials are valid
        Parameters:
        authModel - authentication details such as username, password and optionally clientId
        Returns:
        true if endpoint returns authorization token; otherwise, false
      • getEngineGroupNamesForClient

        Optional<String[]> getEngineGroupNamesForClient​(String authToken)
        fetches the names of available engine groups
        Parameters:
        authToken - authorization token required to execute request
        Returns:
        On success an Optional containing an array of Strings representing the names of available engine groups; otherwise, Optional.empty()
      • getEngineGroupIdFromName

        Optional<String> getEngineGroupIdFromName​(String authToken,
                                                  String engineGroupName)
        fetches the unique id of the engine group given by engineGroupName
        Parameters:
        authToken - authorization token required to execute request
        engineGroupName - name of the engine to get the id of
        Returns:
        Optional containing the id of the engine group if found; otherwise, Optional.empty()
      • runScanByConfigName

        ScanResult runScanByConfigName​(String authToken,
                                       String configName)
        starts a new scan using configuration matching configName
        Parameters:
        authToken - authorization token required to execute request
        configName - name of the config to run
        Returns:
        ScanResult containing details on the success of the request and if successful the unique id of the scan
      • getScanStatus

        Optional<String> getScanStatus​(String authToken,
                                       String scanId)
        gets the current status of the scan identified by scanId
        Parameters:
        authToken - authorization token required to execute request
        scanId - unique scan identifier of the scan
        Returns:
        Optional containing current scan status as String on success; Otherwise Optional.empty()
      • isScanFinished

        boolean isScanFinished​(String authToken,
                               String scanId)
        determines if the scan identified by scanId has finished
        Parameters:
        authToken - authorization token required to execute request
        scanId - unique scan identifier of the scan
        Returns:
        true if scan has finished regardless of how it finished, or false if it hasn't
      • hasReport

        boolean hasReport​(String authToken,
                          String scanId)
        determines if a scan identified by scanId has a report or not
        Parameters:
        authToken - authorization token required to execute request
        scanId - unique scan identifier of the scan
        Returns:
        true if the scan has a report; otherwise, false
      • getConfigNames

        Optional<String[]> getConfigNames​(String authToken)
        returns String[] of scan config names
        Parameters:
        authToken - authorization token required to execute request
        Returns:
        String[] of all scan config names
      • saveConfig

        boolean saveConfig​(String authToken,
                           String name,
                           URL url,
                           String engineGroupId)
        calls the /Configs/SaveConfig endpoint using the provided data to create or update a configuration
        Parameters:
        authToken - authorization token required to execute request
        name - name of the scanconfig to save
        url - target URL for the scan
        engineGroupId - unique engine group id for the engine(s) to be used to execute the scan
        Returns:
        true on success; otherwise, false
      • getVulnerabilitiesSummaryXml

        Optional<String> getVulnerabilitiesSummaryXml​(String authToken,
                                                      String scanId)
        gets the vulnerability summary XML as a String
        Parameters:
        authToken - authorization token required to execute request
        scanId - unique scan identifier of the scan to provide report for
        Returns:
        Optional containing the vulnerability summary as XML String on success; otherwise, Optional.empty()
      • getReportZip

        Optional<InputStream> getReportZip​(String authToken,
                                           String scanId)
        provides InputStream for the request report zip
        Parameters:
        authToken - authorization token required to execute request
        scanId - unique scan identifier of the scan to provide report for
        Returns:
        Optional containing InputStream on success; otherwise, Optional.empty()
      • getClientNameIdPairs

        Optional<List<ClientIdNamePair>> getClientNameIdPairs​(String authToken)
        gets an array of all name/id pairs of clients that the authorized user can access
        Parameters:
        authToken - authorization token required to execute request
        Returns:
        array of ClientIdNamePair objects representing the id's and names of accessible clients