public class ContrastSDK extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ContrastSDK.Builder |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT
Default connection timeout.
|
static int |
DEFAULT_READ_TIMEOUT
Default read timeout.
|
| Constructor and Description |
|---|
ContrastSDK()
Deprecated.
|
ContrastSDK(String user,
String serviceKey,
String apiKey)
Deprecated.
|
ContrastSDK(String user,
String serviceKey,
String apiKey,
String restApiURL)
Deprecated.
|
ContrastSDK(String user,
String serviceKey,
String apiKey,
String restApiURL,
Proxy proxy)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
GenericResponse |
clearNotifications(String organizationId)
Clear notifications for the org.
|
Application |
createApplication(String organizationId,
ApplicationCreateRequest request)
Creates an application without a server that is meant to be instrumented later.
|
void |
downloadAttestationReport(String organizationId,
String userId,
String reportId)
Get the vulnerabilities in the organization whose ID is passed in.
|
void |
downloadFile(HttpMethod method,
String path,
String saveDir) |
GenericResponse |
generateAttestationReport(String organizationId,
String appId,
AttestationCreateRequest request)
Generate an attestation report for the application whose ID is passed in.
|
byte[] |
getAgent(AgentType type,
String organizationId)
Download a contrast.jar agent associated with this account.
|
byte[] |
getAgent(AgentType type,
String organizationId,
String profileName)
Download a contrast.jar agent associated with this account.
|
Applications |
getApplication(String organizationId,
String appId)
Get summary information about a single app without expandValues.
|
Applications |
getApplication(String organizationId,
String appId,
EnumSet<FilterForm.ApplicationExpandValues> expandValues)
Get summary information about a single app.
|
Application |
getApplicationByNameAndLanguage(String orgId,
String appName,
AgentType language)
Gets a single application based on the org, name, and language
|
Applications |
getApplications(String organizationId)
Get the list of applications being monitored by Contrast.
|
Applications |
getApplicationsNames(String organizationId) |
AssessLicenseOverview |
getAssessLicensing(String organizationId)
Get all Assess Licensing for an Organizations.
|
Coverage |
getCoverage(String organizationId,
String appId)
Return coverage data about the monitored Contrast application.
|
List<JobOutcomePolicy> |
getEnabledJobOutcomePolicies(String organizationId)
Gets a list of enabled Job Outcome policies in an organization
|
List<JobOutcomePolicy> |
getEnabledJoboutcomePoliciesByApplication(String organizationId,
String appId)
Gets a list of enabeld Job Outcome Policies in an organization that applies to an application
|
Applications |
getFilteredApplications(String organizationId,
ApplicationFilterForm applicationFilterForm)
Get the list of filtered applications being monitored by Contrast.
|
Libraries |
getLibraries(String organizationId,
String appId) |
Libraries |
getLibraries(String organizationId,
String appId,
EnumSet<FilterForm.LibrariesExpandValues> expandValues)
Return the libraries of the monitored Contrast application.
|
LibraryScores |
getLibraryScores(String organizationId)
Return the library Scores for an Organization.
|
LibraryStats |
getLibraryStats(String organizationId)
Return the library Stats for an Organization.
|
Applications |
getLicensedApplications(String organizationId)
Get the list of licensed applications being monitored by Contrast.
|
TraceNotesResponse |
getNotes(String organizationId,
String appId,
String traceId,
TraceFilterForm form)
Get the notes (discussion) for the vulnerability ID in the application whose ID is passed in.
|
NotificationsResponse |
getNotifications(String organizationId,
TraceFilterForm form)
Get notifications for the org.
|
Users |
getOrganizationUsers(String organizationId)
Get all users for an organization.
|
Organizations |
getProfileDefaultOrganizations()
Get the default organization for the user profile.
|
Organizations |
getProfileOrganizations()
Get all organizations for the user profile.
|
RouteCoverageResponse |
getRouteCoverage(String organizationId,
String appId)
Return route coverage data about the monitored Contrast application.
|
Rules |
getRules(String organizationId)
Get the rules for an organization
|
Servers |
getServers(String organizationId,
ServerFilterForm filterForm)
Return the servers of the monitored Contrast application.
|
Servers |
getServersWithFilter(String organizationId,
ServerFilterForm filterForm)
Return the servers of the monitored Contrast application.
|
ServerTagsResponse |
getServerTags(String organizationId,
String appId)
Get server tags for the org.
|
MetadataFilterResponse |
getSessionMetadataForApplication(String organizationId,
String appId,
TraceFilterForm form)
Get the available session metadata values in the application whose ID is passed in.
|
Traces |
getTraceFilterByRule(String organizationId,
String appId,
List<String> ruleNames)
Deprecated.
|
TraceListing |
getTraceFilters(String organizationId,
String appId)
Get the filters for the traces in the application.
|
Traces |
getTraces(String organizationId,
String appId,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in.
|
Traces |
getTracesInOrg(String organizationId,
TraceFilterForm form)
Get the vulnerabilities in the organization whose ID is passed in.
|
Traces |
getTracesWithFilter(String organizationId,
String appId,
TraceFilterType traceFilterType,
TraceFilterKeycode keycode,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in with a filter.
|
TracesWithResponse |
getTracesWithResponse(String organizationId,
String appId,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in.
|
TagsResponse |
getVulnTagsByApplication(String organizationId,
String appId)
Get the available vulnerability tags in the application whose ID is passed in.
|
VulnerabilityTrend |
getYearlyNewVulnTrend(String organizationId)
Get New (New Open and New Closed each month) Vulnerability Trend for an Organizations.
|
VulnerabilityTrend |
getYearlyVulnTrend(String organizationId)
Get Total (Total Open and Total Closed each month) Vulnerability Trend for an Organizations.
|
VulnerabilityTrend |
getYearlyVulnTrendForApplication(String organizationId,
String appId)
Get all Vulnerability Trend for an Application.
|
HttpURLConnection |
makeConnection(String url,
String method) |
InputStream |
makeRequest(HttpMethod method,
String path) |
InputStream |
makeRequestWithBody(HttpMethod method,
String path,
String body,
MediaType mediaType) |
MakeRequestResponse |
makeRequestWithResponse(HttpMethod method,
String path) |
SecurityCheck |
makeSecurityCheck(String organizationId,
SecurityCheckForm securityCheckForm)
Make a security check in a given organization by the security check form
|
void |
setConnectionTimeout(int timeout)
Sets a custom connection timeout for all SDK requests.
|
void |
setReadTimeout(int timeout)
Set a custom read timeout for all SDK requests.
|
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
@Deprecated public ContrastSDK()
@Deprecated public ContrastSDK(String user, String serviceKey, String apiKey, String restApiURL) throws IllegalArgumentException
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API KeyrestApiURL - the base Contrast API URLIllegalArgumentException - if the API URL is malformed@Deprecated public ContrastSDK(String user, String serviceKey, String apiKey, String restApiURL, Proxy proxy) throws IllegalArgumentException
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API KeyrestApiURL - the base Contrast API URLproxy - Proxy to useIllegalArgumentException - if the API URL is malformed@Deprecated public ContrastSDK(String user, String serviceKey, String apiKey)
This will use the default api url which is https://app.contrastsecurity.com/Contrast/api
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API Keypublic AssessLicenseOverview getAssessLicensing(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic VulnerabilityTrend getYearlyVulnTrend(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic VulnerabilityTrend getYearlyNewVulnTrend(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic VulnerabilityTrend getYearlyVulnTrendForApplication(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Organizations getProfileOrganizations() throws IOException, UnauthorizedException
UnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Users getOrganizationUsers(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Organizations getProfileDefaultOrganizations() throws IOException, UnauthorizedException
UnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Application createApplication(String organizationId, ApplicationCreateRequest request) throws IOException, UnauthorizedException, ApplicationCreateException
organizationId - request - IOExceptionUnauthorizedExceptionApplicationCreateExceptionpublic Application getApplicationByNameAndLanguage(String orgId, String appName, AgentType language) throws IOException, UnauthorizedException
orgId - ID of the organizationappName - Application name when the application was first createdlanguage - Language of the applicationIOExceptionUnauthorizedExceptionpublic Applications getApplication(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplication(String organizationId, String appId, EnumSet<FilterForm.ApplicationExpandValues> expandValues) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationexpandValues - Expand values to filter onUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplications(String organizationId) throws UnauthorizedException, IOException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getFilteredApplications(String organizationId, ApplicationFilterForm applicationFilterForm) throws UnauthorizedException, IOException
organizationId - the ID of the organizationapplicationFilterForm - Query params to add more info to responseUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getLicensedApplications(String organizationId) throws UnauthorizedException, IOException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplicationsNames(String organizationId) throws UnauthorizedException, IOException
UnauthorizedExceptionIOExceptionpublic RouteCoverageResponse getRouteCoverage(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Coverage getCoverage(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Libraries getLibraries(String organizationId, String appId) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic Libraries getLibraries(String organizationId, String appId, EnumSet<FilterForm.LibrariesExpandValues> expandValues) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationexpandValues - Query params to add more info to responseUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic LibraryScores getLibraryScores(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic LibraryStats getLibraryStats(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Servers getServers(String organizationId, ServerFilterForm filterForm) throws IOException, UnauthorizedException
organizationId - the ID of the organizationfilterForm - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Servers getServersWithFilter(String organizationId, ServerFilterForm filterForm) throws IOException, UnauthorizedException
organizationId - the ID of the organizationfilterForm - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Traces getTraces(String organizationId, String appId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic TracesWithResponse getTracesWithResponse(String organizationId, String appId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic TraceNotesResponse getNotes(String organizationId, String appId, String traceId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationtraceId - the ID of the vulnerabilityform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic TagsResponse getVulnTagsByApplication(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic MetadataFilterResponse getSessionMetadataForApplication(String organizationId, String appId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic GenericResponse generateAttestationReport(String organizationId, String appId, AttestationCreateRequest request) throws IOException, UnauthorizedException, ApplicationCreateException
organizationId - the ID of the organizationappId - the ID of the applicationrequest - IOExceptionUnauthorizedExceptionApplicationCreateExceptionpublic void downloadAttestationReport(String organizationId, String userId, String reportId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationuserId - the id of the user who requested the reportreportId - the id of the report that was generatedUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic NotificationsResponse getNotifications(String organizationId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic ServerTagsResponse getServerTags(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the appUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic GenericResponse clearNotifications(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Traces getTracesInOrg(String organizationId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic TraceListing getTraceFilters(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Traces getTracesWithFilter(String organizationId, String appId, TraceFilterType traceFilterType, TraceFilterKeycode keycode, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationtraceFilterType - filter typekeycode - id or key to filter onform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problem@Deprecated public Traces getTraceFilterByRule(String organizationId, String appId, List<String> ruleNames) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationruleNames - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic SecurityCheck makeSecurityCheck(String organizationId, SecurityCheckForm securityCheckForm) throws IOException, UnauthorizedException
organizationId - the ID of the organizationsecurityCheckForm - the security check formIOExceptionUnauthorizedExceptionpublic List<JobOutcomePolicy> getEnabledJobOutcomePolicies(String organizationId) throws IOException, UnauthorizedException
organizationId - The organization IDIOExceptionUnauthorizedExceptionpublic List<JobOutcomePolicy> getEnabledJoboutcomePoliciesByApplication(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - The organization IDappId - The Application IDIOExceptionUnauthorizedExceptionpublic Rules getRules(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic byte[] getAgent(AgentType type, String organizationId, String profileName) throws IOException, UnauthorizedException
type - the type of agent you want to download; Java, Java 1.5, .NET, or NodeprofileName - the name of the saved engine profile to download,organizationId - the ID of the organization,IOException - if there was a communication problemUnauthorizedException - if authentication failspublic byte[] getAgent(AgentType type, String organizationId) throws IOException, UnauthorizedException
This uses 'default' as the profile name.
type - the type of agent you want to download; Java, Java 1.5, .NET, or NodeorganizationId - the ID of the organization,IOException - if there was a communication problemUnauthorizedException - if authentication failspublic InputStream makeRequestWithBody(HttpMethod method, String path, String body, MediaType mediaType) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic InputStream makeRequest(HttpMethod method, String path) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic MakeRequestResponse makeRequestWithResponse(HttpMethod method, String path) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic void downloadFile(HttpMethod method, String path, String saveDir) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic HttpURLConnection makeConnection(String url, String method) throws IOException
IOExceptionpublic void setConnectionTimeout(int timeout)
timeout - Timeout value in milliseconds.public void setReadTimeout(int timeout)
timeout - TImeout value in millisecondsCopyright © 2021 Contrast Security. All rights reserved.