forked from cxadmin/checkmarx-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from checkmarx-ltd/2024_Q4_IntegrationBranch_Cr…
…iticalSeverity Critical Severity
- Loading branch information
Showing
4 changed files
with
141 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.cx.plugin.utils; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.cx.plugin.CxScanPlugin; | ||
import com.cx.restclient.CxClientDelegator; | ||
import com.cx.restclient.configuration.CxScanConfig; | ||
import com.cx.restclient.dto.ScannerType; | ||
import com.cx.restclient.exception.CxClientException; | ||
import com.cx.restclient.sast.utils.LegacyClient; | ||
|
||
public class SASTUtils { | ||
|
||
public static LegacyClient getInstance(CxScanConfig config, Logger log) | ||
throws MalformedURLException, CxClientException { | ||
return new LegacyClient(config, log) { | ||
}; | ||
} | ||
|
||
private static final Logger log = LoggerFactory.getLogger(SASTUtils.class); | ||
private CxClientDelegator clientDelegator; | ||
|
||
public static String loginToServer(URL url, String username, String pssd) { | ||
String version = null; | ||
String result = ""; | ||
try { | ||
CxScanConfig scanConfig = new CxScanConfig(url.toString().trim(), username, pssd, | ||
CxScanPlugin.PLUGIN_ORIGIN, true); | ||
scanConfig.addScannerType(ScannerType.SAST); | ||
LegacyClient clientCommon = getInstance(scanConfig, log); | ||
version = clientCommon.login(true); | ||
return version; | ||
} catch (Exception ex) { | ||
result = ex.getMessage(); | ||
return version; | ||
} | ||
} | ||
} |