Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/ast-cli-java-wrapper-1.0.12.jar" sourcepath="D:/git/CheckmarxDev/ast-cli-wrapper"/>
<classpathentry exported="true" kind="lib" path="lib/ast-cli-java-wrapper-1.0.18.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.12.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-annotations-2.12.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.12.4.jar"/>
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
5 changes: 3 additions & 2 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Checkmarx
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime;bundle-version="3.22.0",
org.eclipse.jdt.core;bundle-version="3.26.0"
org.eclipse.jdt.core;bundle-version="3.26.0",
org.eclipse.ui.ide;bundle-version="3.18.300"
Automatic-Module-Name: com.checkmarx.eclipse
Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: org.eclipse.core.resources
Expand All @@ -20,5 +21,5 @@ Bundle-ClassPath: lib/lombok-1.18.20.jar,
lib/jackson-core-2.12.4.jar,
lib/jackson-databind-2.12.4.jar,
lib/commons-lang3-3.12.0.jar,
lib/ast-cli-java-wrapper-1.0.12.jar,
lib/ast-cli-java-wrapper-1.0.18.jar,
.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ bin.includes = plugin.xml,\
lib/jackson-core-2.12.4.jar,\
lib/jackson-databind-2.12.4.jar,\
lib/commons-lang3-3.12.0.jar,\
lib/ast-cli-java-wrapper-1.0.12.jar,\
lib/ast-cli-java-wrapper-1.0.18.jar,\
.
source.. = src/
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ protected AuthButtonFieldEditor(String name, String labelText,
@Override
protected String changePressed() {

Integer result = Authenticator.INSTANCE.doAuthentication();
if(result == 0)
String result = Authenticator.INSTANCE.doAuthentication();
if(!result.isEmpty())
{
MessageDialog.openInformation(null, "Authentication", "Connection successfull !");
}
Expand Down
36 changes: 19 additions & 17 deletions src/com/checkmarx/eclipse/runner/Authenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.checkmarx.ast.exceptions.CxException;
import com.checkmarx.ast.scans.CxAuth;
import com.checkmarx.ast.scans.CxScanConfig;
import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxConfig.InvalidCLIConfigException;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.ast.wrapper.CxWrapper;
import com.checkmarx.eclipse.properties.Preferences;

public class Authenticator {
Expand All @@ -33,32 +34,33 @@ public class Authenticator {
//
// }

public Integer doAuthentication() {
public String doAuthentication() {

CxScanConfig config = new CxScanConfig();
CxConfig config = CxConfig.builder().baseUri(Preferences.getServerUrl()).tenant(Preferences.getTenant()).apiKey(Preferences.getApiKey()).additionalParameters("").build();

config.setBaseUri(Preferences.getServerUrl());
config.setTenant(Preferences.getTenant());
config.setApiKey(Preferences.getApiKey());
// config.setBaseUri(Preferences.getServerUrl());
// config.setTenant(Preferences.getTenant());
// config.setApiKey(Preferences.getApiKey());

Logger log = LoggerFactory.getLogger(Authenticator.class.getName());

CxAuth cxAuth;
CxWrapper wrapper;
try {
cxAuth = new CxAuth(config, log);
Integer result = cxAuth.cxAuthValidate();
System.out.println("Authentication Status :" + result);
return result;
} catch (CxException e) {
wrapper = new CxWrapper(config, log);
String cxValidateOutput = wrapper.authValidate();
// Integer result = cxValidateOutput.getExitCode();
System.out.println("Authentication Status :" + cxValidateOutput);
return cxValidateOutput;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
} catch (InvalidCLIConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
} catch (CxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Expand Down
7 changes: 7 additions & 0 deletions src/com/checkmarx/eclipse/utils/PluginConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.checkmarx.eclipse.utils;

public class PluginConstants {
public static final String SAST = "sast";
public static final String SCA_DEPENDENCY = "dependency";
public static final String KICS_INFRASTRUCTURE = "infrastructure";
}
Loading