From 7d82ba890429a5f7d8866dc7f7212c796692d951 Mon Sep 17 00:00:00 2001 From: Matt Murphy Date: Fri, 5 May 2017 13:26:33 -0400 Subject: [PATCH 1/3] add presence provider --- .../appscan/plugin/core/CoreConstants.java | 102 +++++----- .../appscan/plugin/core/messages.properties | 7 + .../core/presence/CloudPresenceProvider.java | 176 ++++++++++++++++++ .../core/presence/IPresenceProvider.java | 40 ++++ 4 files changed, 276 insertions(+), 49 deletions(-) create mode 100644 src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java create mode 100644 src/main/java/com/ibm/appscan/plugin/core/presence/IPresenceProvider.java diff --git a/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java b/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java index 239a308..d06562d 100644 --- a/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java +++ b/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java @@ -7,66 +7,70 @@ public interface CoreConstants { - String APP_ID = "AppId"; //$NON-NLS-1$ + String APP_ID = "AppId"; //$NON-NLS-1$ String EMAIL_NOTIFICATION = "EnableMailNotification"; //$NON-NLS-1$ - String FILE_ID = "FileId"; //$NON-NLS-1$ + String FILE_ID = "FileId"; //$NON-NLS-1$ String FILE_TO_UPLOAD = "fileToUpload"; //$NON-NLS-1$ - String ID = "Id"; //$NON-NLS-1$ + String ID = "Id"; //$NON-NLS-1$ + String KEY = "Key"; //$NON-NLS-1$ String LATEST_EXECUTION = "LatestExecution"; //$NON-NLS-1$ - String LOCALE = "Locale"; //$NON-NLS-1$ - String MESSAGE = "Message"; //$NON-NLS-1$ - String NAME = "Name"; //$NON-NLS-1$ - String SCAN_NAME = "ScanName"; //$NON-NLS-1$ - String SCANNER_TYPE = "type"; //$NON-NLS-1$ - String STATUS = "Status"; //$NON-NLS-1$ - String TARGET = "target"; //$NON-NLS-1$ + String LOCALE = "Locale"; //$NON-NLS-1$ + String MESSAGE = "Message"; //$NON-NLS-1$ + String NAME = "Name"; //$NON-NLS-1$ + String SCAN_NAME = "ScanName"; //$NON-NLS-1$ + String SCANNER_TYPE = "type"; //$NON-NLS-1$ + String STATUS = "Status"; //$NON-NLS-1$ + String TARGET = "target"; //$NON-NLS-1$ String VERSION_NUMBER = "VersionNumber"; //$NON-NLS-1$ - String BINDING_ID = "Bindingid"; //$NON-NLS-1$ - String KEY_ID = "KeyId"; //$NON-NLS-1$ - String KEY_SECRET = "KeySecret"; //$NON-NLS-1$ - String PASSWORD = "Password"; //$NON-NLS-1$ - String TOKEN = "Token"; //$NON-NLS-1$ - String USERNAME = "Username"; //$NON-NLS-1$ + String BINDING_ID = "Bindingid"; //$NON-NLS-1$ + String KEY_ID = "KeyId"; //$NON-NLS-1$ + String KEY_SECRET = "KeySecret"; //$NON-NLS-1$ + String PASSWORD = "Password"; //$NON-NLS-1$ + String TOKEN = "Token"; //$NON-NLS-1$ + String USERNAME = "Username"; //$NON-NLS-1$ - String CHARSET = "charset"; //$NON-NLS-1$ - String UTF8 = "utf-8"; //$NON-NLS-1$ + String CHARSET = "charset"; //$NON-NLS-1$ + String UTF8 = "utf-8"; //$NON-NLS-1$ String CONTENT_DISPOSITION = "Content-Disposition"; //$NON-NLS-1$ String CONTENT_LENGTH = "Content-Length"; //$NON-NLS-1$ - String CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$ + String CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$ - String API_ENV = "/api/v2"; //$NON-NLS-1$ - String API_BLUEMIX = "Bluemix"; //$NON-NLS-1$ - String API_BLUEMIX_LOGIN = API_ENV + "/Account/BluemixLogin"; //$NON-NLS-1$ - String API_IBM_LOGIN = API_ENV + "/Account/IBMIdLogin"; //$NON-NLS-1$ - String API_KEY_LOGIN = API_ENV + "/Account/ApiKeyLogin"; //$NON-NLS-1$ - String API_LOGOUT = API_ENV + "/Account/Logout"; //$NON-NLS-1$ - String API_APPS = API_ENV + "/Apps"; //$NON-NLS-1$ - String API_BASIC_DETAILS = API_ENV + "/Scans/%s"; //$NON-NLS-1$ - String API_SCANNER_DETAILS = API_ENV + "/Scans/&s/&s"; //$NON-NLS-1$ - String API_FILE_UPLOAD = API_ENV + "/FileUpload"; //$NON-NLS-1$ - String API_SCAN = API_ENV + "/%s"; //$NON-NLS-1$ - String API_SCANNER = API_ENV + "/Scans/%s"; //$NON-NLS-1$ - String API_SCANS = API_ENV + "/Scans"; //$NON-NLS-1$ - String API_SCANS_REPORT = API_ENV + "/Scans/%s/Report/%s"; //$NON-NLS-1$ - String API_SCX = "SCX"; //$NON-NLS-1$ - String API_SACLIENT_DOWNLOAD = "/api/%s/StaticAnalyzer/SAClientUtil?os=%s"; //$NON-NLS-1$ + String API_ENV = "/api/v2"; //$NON-NLS-1$ + String API_BLUEMIX = "Bluemix"; //$NON-NLS-1$ + String API_BLUEMIX_LOGIN = API_ENV + "/Account/BluemixLogin"; //$NON-NLS-1$ + String API_IBM_LOGIN = API_ENV + "/Account/IBMIdLogin"; //$NON-NLS-1$ + String API_KEY_LOGIN = API_ENV + "/Account/ApiKeyLogin"; //$NON-NLS-1$ + String API_LOGOUT = API_ENV + "/Account/Logout"; //$NON-NLS-1$ + String API_APPS = API_ENV + "/Apps"; //$NON-NLS-1$ + String API_PRESENCES = API_ENV + "/Presences"; //$NON-NLS-1$ + String API_PRESENCES_ID = API_ENV + "/Presences/%s"; //$NON-NLS-1$ + String API_PRESENCES_NEW_KEY = API_ENV + "/Presences/%s/NewKey"; //$NON-NLS-1$ + String API_BASIC_DETAILS = API_ENV + "/Scans/%s"; //$NON-NLS-1$ + String API_SCANNER_DETAILS = API_ENV + "/Scans/&s/&s"; //$NON-NLS-1$ + String API_FILE_UPLOAD = API_ENV + "/FileUpload"; //$NON-NLS-1$ + String API_SCAN = API_ENV + "/%s"; //$NON-NLS-1$ + String API_SCANNER = API_ENV + "/Scans/%s"; //$NON-NLS-1$ + String API_SCANS = API_ENV + "/Scans"; //$NON-NLS-1$ + String API_SCANS_REPORT = API_ENV + "/Scans/%s/Report/%s"; //$NON-NLS-1$ + String API_SCX = "SCX"; //$NON-NLS-1$ + String API_SACLIENT_DOWNLOAD = "/api/%s/StaticAnalyzer/SAClientUtil?os=%s"; //$NON-NLS-1$ String API_SACLIENT_VERSION = "/api/%s/StaticAnalyzer/SAClientUtil?os=%s&meta=%s"; //$NON-NLS-1$ - String API_KEY_PATH = "/api/ideclientuilogin"; //$NON-NLS-1$ + String API_KEY_PATH = "/api/ideclientuilogin"; //$NON-NLS-1$ - String DEFAULT_RESULT_NAME = "asoc_results"; //$NON-NLS-1$ - String SACLIENT_INSTALL_DIR = "SAClientInstall"; //$NON-NLS-1$ + String DEFAULT_RESULT_NAME = "asoc_results"; //$NON-NLS-1$ + String SACLIENT_INSTALL_DIR = "SAClientInstall"; //$NON-NLS-1$ - String RUNNING = "Running"; //$NON-NLS-1$ - String READY = "Ready"; //$NON-NLS-1$ - String FAILED = "Failed"; //$NON-NLS-1$ + String RUNNING = "Running"; //$NON-NLS-1$ + String READY = "Ready"; //$NON-NLS-1$ + String FAILED = "Failed"; //$NON-NLS-1$ - String TOTAL_ISSUES = "NIssuesFound"; //$NON-NLS-1$ - String HIGH_ISSUES = "NHighIssues"; //$NON-NLS-1$ + String TOTAL_ISSUES = "NIssuesFound"; //$NON-NLS-1$ + String HIGH_ISSUES = "NHighIssues"; //$NON-NLS-1$ String MEDIUM_ISSUES = "NMediumIssues"; //$NON-NLS-1$ - String LOW_ISSUES = "NLowIssues"; //$NON-NLS-1$ - String INFO_ISSUES = "NInfoIssues"; //$NON-NLS-1$ + String LOW_ISSUES = "NLowIssues"; //$NON-NLS-1$ + String INFO_ISSUES = "NInfoIssues"; //$NON-NLS-1$ String CREATE_SCAN_SUCCESS = "message.created.scan"; //$NON-NLS-1$ String DOWNLOADING_CLIENT = "message.downloading.client"; //$NON-NLS-1$ @@ -74,14 +78,14 @@ public interface CoreConstants { String UPLOADING_FILE = "message.uploading.file"; //$NON-NLS-1$ String ERROR_AUTHENTICATING = "error.authenticating"; //$NON-NLS-1$ - String ERROR_DOWNLOADING_CLIENT = "error.download.client"; //$NON-NLS-1$ - String ERROR_GETTING_DETAILS = "error.getting.details"; //$NON-NLS-1$ + String ERROR_DOWNLOADING_CLIENT = "error.download.client"; //$NON-NLS-1$ + String ERROR_GETTING_DETAILS = "error.getting.details"; //$NON-NLS-1$ String ERROR_GETTING_RESULT = "error.getting.result"; //$NON-NLS-1$ String ERROR_INVALID_APP = "error.invalid.app"; //$NON-NLS-1$ - String ERROR_INVALID_OPTIONS = "error.invalid.opts"; //$NON-NLS-1$ + String ERROR_INVALID_OPTIONS = "error.invalid.opts"; //$NON-NLS-1$ String ERROR_LOADING_APPS = "error.loading.apps"; //$NON-NLS-1$ String ERROR_LOGIN_EXPIRED = "login.token.expired"; //$NON-NLS-1$ String ERROR_INVALID_JOB_ID = "error.invalid.job.id"; //$NON-NLS-1$ - String ERROR_SUBMITTING_SCAN = "error.submit.scan"; //$NON-NLS-1$ + String ERROR_SUBMITTING_SCAN = "error.submit.scan"; //$NON-NLS-1$ String ERROR_UPLOADING_FILE = "error.upload.file"; //$NON-NLS-1$ } diff --git a/src/main/java/com/ibm/appscan/plugin/core/messages.properties b/src/main/java/com/ibm/appscan/plugin/core/messages.properties index b5f4e57..58dcdea 100644 --- a/src/main/java/com/ibm/appscan/plugin/core/messages.properties +++ b/src/main/java/com/ibm/appscan/plugin/core/messages.properties @@ -20,6 +20,13 @@ error.invalid.job.id=Job ID {0} is invalid or does not exist. error.loading.apps=An error occurred retrieving the application list. {0} error.submit.scan=An error occurred submitting the scan to the service. ERROR: {0} error.upload.file=An error occurred uploading {0} to the service. {0} +error.service.general=An unknown error occurred. Response code: {0} + +#Presence +error.getting.presence.details=An error occurred retrieving details for Presence with id {0}. +error.loading.presences=An error occurred retrieving the list of Presences. +error.getting.new.key=An error occurred generating a new key for Presence with id {0}. +error.deleting.presence=An error occurred deleting Presence with id {0}. #Authentication login.error=Unable to authenticate to the service. diff --git a/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java b/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java new file mode 100644 index 0000000..3d0baf8 --- /dev/null +++ b/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java @@ -0,0 +1,176 @@ +package com.ibm.appscan.plugin.core.presence; + +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.apache.wink.json4j.JSONArray; +import org.apache.wink.json4j.JSONException; +import org.apache.wink.json4j.JSONObject; + +import com.ibm.appscan.plugin.core.CoreConstants; +import com.ibm.appscan.plugin.core.Messages; +import com.ibm.appscan.plugin.core.auth.IAuthenticationProvider; +import com.ibm.appscan.plugin.core.http.HttpClient; +import com.ibm.appscan.plugin.core.http.HttpResponse; +import com.ibm.appscan.plugin.core.logging.DefaultProgress; +import com.ibm.appscan.plugin.core.logging.IProgress; +import com.ibm.appscan.plugin.core.logging.Message; + +public class CloudPresenceProvider implements IPresenceProvider, CoreConstants { + + private Map m_presences; + private IProgress m_progress; + private IAuthenticationProvider m_authProvider; + + public CloudPresenceProvider(IAuthenticationProvider provider) { + this(provider, new DefaultProgress()); + } + + public CloudPresenceProvider(IAuthenticationProvider provider, IProgress progress) { + m_authProvider = provider; + m_progress = progress; + } + + @Override + public Map getPresences() { + if(m_presences == null) + loadPresences(); + return m_presences; + } + + @Override + public String getName(String id) { + return getPresences().get(id); + } + + @Override + public boolean delete(String id) { + if(!authenticated()) + return false; + + String url = m_authProvider.getServer() + String.format(API_PRESENCES_ID, id); + Map headers = m_authProvider.getAuthorizationHeader(true); + + HttpClient client = new HttpClient(); + + try { + HttpResponse response = client.delete(url, headers, null); + if(response.isSuccess()) + return true; + handleError(response); + } + catch(IOException | JSONException e) { + m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage("error.deleting.presence", id)), e); //$NON-NLS-1$ + } + + return false; + } + + @Override + public Map getDetails(String id) { + if(!authenticated()) + return null; + + String url = m_authProvider.getServer() + String.format(API_PRESENCES_ID, id); + Map headers = m_authProvider.getAuthorizationHeader(true); + Map details = new HashMap(); + + HttpClient client = new HttpClient(); + + try { + HttpResponse response = client.get(url, headers, null); + if(response.isSuccess()) { + JSONObject json = (JSONObject) response.getResponseBodyAsJSON(); + for(Object key : json.keySet()) + details.put((String)key, json.getString((String)key)); + } + else + handleError(response); + } + catch(IOException | JSONException e) { + m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage("error.getting.presence.details", id)), e); //$NON-NLS-1$ + } + + return details; + } + + @Override + public String getNewKey(String id) { + if(!authenticated()) + return null; + + String key = null; + String url = m_authProvider.getServer() + String.format(API_PRESENCES_NEW_KEY, id); + Map headers = m_authProvider.getAuthorizationHeader(true); + + HttpClient client = new HttpClient(); + + try { + HttpResponse response = client.get(url, headers, null); + if(response.isSuccess()) { + JSONObject json = (JSONObject) response.getResponseBodyAsJSON(); + key = json.getString(KEY); + } + else + handleError(response); + } + catch(IOException | JSONException e) { + m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage("error.getting.new.key", id)), e); //$NON-NLS-1$ + } + + return key; + } + + private void loadPresences() { + if(!authenticated()) + return; + + m_presences = new HashMap(); + String url = m_authProvider.getServer() + API_PRESENCES + "?fields=Name&sort=%2BName"; //$NON-NLS-1$ + Map headers = m_authProvider.getAuthorizationHeader(true); + headers.putAll(Collections.singletonMap("range", "items=0-999999")); //$NON-NLS-1$ //$NON-NLS-2$ + + HttpClient client = new HttpClient(); + + try { + HttpResponse response = client.get(url, headers, null); + + if (response.isSuccess()) { + JSONArray array = (JSONArray)response.getResponseBodyAsJSON(); + if(array == null) + return; + + for(int i = 0; i < array.length(); i++) { + JSONObject object = array.getJSONObject(i); + String id = object.getString(ID); + String name = object.getString(NAME); + m_presences.put(id, name); + } + } + else + handleError(response); + } + catch(IOException | JSONException e) { + m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage("error.loading.presences")), e); //$NON-NLS-1$ + m_presences = null; + } + } + + private void handleError(HttpResponse response) throws IOException, JSONException { + JSONObject json = (JSONObject)response.getResponseBodyAsJSON(); + if(json != null && json.has(MESSAGE)) + m_progress.setStatus(new Message(Message.ERROR, json.getString(MESSAGE))); + else + m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage("error.service.general", response.getResponseCode()))); //$NON-NLS-1$ + } + + private boolean authenticated() { + if(m_authProvider.isTokenExpired()) { + m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage("login.error"))); //$NON-NLS-1$ + return false; + } + return true; + } +} diff --git a/src/main/java/com/ibm/appscan/plugin/core/presence/IPresenceProvider.java b/src/main/java/com/ibm/appscan/plugin/core/presence/IPresenceProvider.java new file mode 100644 index 0000000..e718428 --- /dev/null +++ b/src/main/java/com/ibm/appscan/plugin/core/presence/IPresenceProvider.java @@ -0,0 +1,40 @@ +package com.ibm.appscan.plugin.core.presence; + +import java.util.Map; + +public interface IPresenceProvider { + + /** + * Gets the available presences. + * @return A Map of presences, keyed by the presence id. + */ + public Map getPresences(); + + /** + * Gets the name of the presence with the given id. + * @param id The id of the presence. + * @return The presence name. + */ + public String getName(String id); + + /** + * Deletes the presence with the given id. + * @param id The id of the presence to delete. + * @return true if the delete was successful. + */ + public boolean delete(String id); + + /** + * Retrieves details about the presence with the given id. + * @param id The id of the presence. + * @return A Map containing details of the presence. + */ + public Map getDetails(String id); + + /** + * Generate a new key for the given presence. + * @param id The id of the presence to generate the new key for. + * @return The new key. + */ + public String getNewKey(String id); +} From bfde5191b0a8030e6aa73e45e79c500fd3350e0f Mon Sep 17 00:00:00 2001 From: mattmurp Date: Fri, 5 May 2017 13:37:11 -0400 Subject: [PATCH 2/3] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bc26d23..ff7f811 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.ibm.appscan com.ibm.appscan.plugin.core - 1.0.2 + 1.0.3 jar From 2e48a67458885cbb8859ec7eadf8faf2cf7eb126 Mon Sep 17 00:00:00 2001 From: Matt Murphy Date: Fri, 5 May 2017 16:24:28 -0400 Subject: [PATCH 3/3] update constants --- .../appscan/plugin/core/CoreConstants.java | 97 ++++++++++--------- .../core/presence/CloudPresenceProvider.java | 2 +- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java b/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java index d06562d..e25b945 100644 --- a/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java +++ b/src/main/java/com/ibm/appscan/plugin/core/CoreConstants.java @@ -7,38 +7,39 @@ public interface CoreConstants { - String APP_ID = "AppId"; //$NON-NLS-1$ - String EMAIL_NOTIFICATION = "EnableMailNotification"; //$NON-NLS-1$ - String FILE_ID = "FileId"; //$NON-NLS-1$ - String FILE_TO_UPLOAD = "fileToUpload"; //$NON-NLS-1$ - String ID = "Id"; //$NON-NLS-1$ - String KEY = "Key"; //$NON-NLS-1$ - String LATEST_EXECUTION = "LatestExecution"; //$NON-NLS-1$ - String LOCALE = "Locale"; //$NON-NLS-1$ - String MESSAGE = "Message"; //$NON-NLS-1$ - String NAME = "Name"; //$NON-NLS-1$ - String SCAN_NAME = "ScanName"; //$NON-NLS-1$ - String SCANNER_TYPE = "type"; //$NON-NLS-1$ - String STATUS = "Status"; //$NON-NLS-1$ - String TARGET = "target"; //$NON-NLS-1$ - String VERSION_NUMBER = "VersionNumber"; //$NON-NLS-1$ + String APP_ID = "AppId"; //$NON-NLS-1$ + String EMAIL_NOTIFICATION = "EnableMailNotification"; //$NON-NLS-1$ + String FILE_ID = "FileId"; //$NON-NLS-1$ + String FILE_TO_UPLOAD = "fileToUpload"; //$NON-NLS-1$ + String ID = "Id"; //$NON-NLS-1$ + String KEY = "Key"; //$NON-NLS-1$ + String LATEST_EXECUTION = "LatestExecution"; //$NON-NLS-1$ + String LOCALE = "Locale"; //$NON-NLS-1$ + String MESSAGE = "Message"; //$NON-NLS-1$ + String NAME = "Name"; //$NON-NLS-1$ + String PRESENCE_NAME = "PresenceName"; //$NON-NLS-1$ + String SCAN_NAME = "ScanName"; //$NON-NLS-1$ + String SCANNER_TYPE = "type"; //$NON-NLS-1$ + String STATUS = "Status"; //$NON-NLS-1$ + String TARGET = "target"; //$NON-NLS-1$ + String VERSION_NUMBER = "VersionNumber"; //$NON-NLS-1$ - String BINDING_ID = "Bindingid"; //$NON-NLS-1$ - String KEY_ID = "KeyId"; //$NON-NLS-1$ - String KEY_SECRET = "KeySecret"; //$NON-NLS-1$ - String PASSWORD = "Password"; //$NON-NLS-1$ - String TOKEN = "Token"; //$NON-NLS-1$ - String USERNAME = "Username"; //$NON-NLS-1$ + String BINDING_ID = "Bindingid"; //$NON-NLS-1$ + String KEY_ID = "KeyId"; //$NON-NLS-1$ + String KEY_SECRET = "KeySecret"; //$NON-NLS-1$ + String PASSWORD = "Password"; //$NON-NLS-1$ + String TOKEN = "Token"; //$NON-NLS-1$ + String USERNAME = "Username"; //$NON-NLS-1$ - String CHARSET = "charset"; //$NON-NLS-1$ - String UTF8 = "utf-8"; //$NON-NLS-1$ + String CHARSET = "charset"; //$NON-NLS-1$ + String UTF8 = "utf-8"; //$NON-NLS-1$ - String CONTENT_DISPOSITION = "Content-Disposition"; //$NON-NLS-1$ - String CONTENT_LENGTH = "Content-Length"; //$NON-NLS-1$ - String CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$ + String CONTENT_DISPOSITION = "Content-Disposition"; //$NON-NLS-1$ + String CONTENT_LENGTH = "Content-Length"; //$NON-NLS-1$ + String CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$ - String API_ENV = "/api/v2"; //$NON-NLS-1$ - String API_BLUEMIX = "Bluemix"; //$NON-NLS-1$ + String API_ENV = "/api/v2"; //$NON-NLS-1$ + String API_BLUEMIX = "Bluemix"; //$NON-NLS-1$ String API_BLUEMIX_LOGIN = API_ENV + "/Account/BluemixLogin"; //$NON-NLS-1$ String API_IBM_LOGIN = API_ENV + "/Account/IBMIdLogin"; //$NON-NLS-1$ String API_KEY_LOGIN = API_ENV + "/Account/ApiKeyLogin"; //$NON-NLS-1$ @@ -66,26 +67,26 @@ public interface CoreConstants { String READY = "Ready"; //$NON-NLS-1$ String FAILED = "Failed"; //$NON-NLS-1$ - String TOTAL_ISSUES = "NIssuesFound"; //$NON-NLS-1$ - String HIGH_ISSUES = "NHighIssues"; //$NON-NLS-1$ - String MEDIUM_ISSUES = "NMediumIssues"; //$NON-NLS-1$ - String LOW_ISSUES = "NLowIssues"; //$NON-NLS-1$ - String INFO_ISSUES = "NInfoIssues"; //$NON-NLS-1$ + String TOTAL_ISSUES = "NIssuesFound"; //$NON-NLS-1$ + String HIGH_ISSUES = "NHighIssues"; //$NON-NLS-1$ + String MEDIUM_ISSUES = "NMediumIssues"; //$NON-NLS-1$ + String LOW_ISSUES = "NLowIssues"; //$NON-NLS-1$ + String INFO_ISSUES = "NInfoIssues"; //$NON-NLS-1$ - String CREATE_SCAN_SUCCESS = "message.created.scan"; //$NON-NLS-1$ - String DOWNLOADING_CLIENT = "message.downloading.client"; //$NON-NLS-1$ - String EXECUTING_SCAN = "message.running.scan"; //$NON-NLS-1$ - String UPLOADING_FILE = "message.uploading.file"; //$NON-NLS-1$ + String CREATE_SCAN_SUCCESS = "message.created.scan"; //$NON-NLS-1$ + String DOWNLOADING_CLIENT = "message.downloading.client"; //$NON-NLS-1$ + String EXECUTING_SCAN = "message.running.scan"; //$NON-NLS-1$ + String UPLOADING_FILE = "message.uploading.file"; //$NON-NLS-1$ - String ERROR_AUTHENTICATING = "error.authenticating"; //$NON-NLS-1$ - String ERROR_DOWNLOADING_CLIENT = "error.download.client"; //$NON-NLS-1$ - String ERROR_GETTING_DETAILS = "error.getting.details"; //$NON-NLS-1$ - String ERROR_GETTING_RESULT = "error.getting.result"; //$NON-NLS-1$ - String ERROR_INVALID_APP = "error.invalid.app"; //$NON-NLS-1$ - String ERROR_INVALID_OPTIONS = "error.invalid.opts"; //$NON-NLS-1$ - String ERROR_LOADING_APPS = "error.loading.apps"; //$NON-NLS-1$ - String ERROR_LOGIN_EXPIRED = "login.token.expired"; //$NON-NLS-1$ - String ERROR_INVALID_JOB_ID = "error.invalid.job.id"; //$NON-NLS-1$ - String ERROR_SUBMITTING_SCAN = "error.submit.scan"; //$NON-NLS-1$ - String ERROR_UPLOADING_FILE = "error.upload.file"; //$NON-NLS-1$ + String ERROR_AUTHENTICATING = "error.authenticating"; //$NON-NLS-1$ + String ERROR_DOWNLOADING_CLIENT = "error.download.client"; //$NON-NLS-1$ + String ERROR_GETTING_DETAILS = "error.getting.details"; //$NON-NLS-1$ + String ERROR_GETTING_RESULT = "error.getting.result"; //$NON-NLS-1$ + String ERROR_INVALID_APP = "error.invalid.app"; //$NON-NLS-1$ + String ERROR_INVALID_OPTIONS = "error.invalid.opts"; //$NON-NLS-1$ + String ERROR_LOADING_APPS = "error.loading.apps"; //$NON-NLS-1$ + String ERROR_LOGIN_EXPIRED = "login.token.expired"; //$NON-NLS-1$ + String ERROR_INVALID_JOB_ID = "error.invalid.job.id"; //$NON-NLS-1$ + String ERROR_SUBMITTING_SCAN = "error.submit.scan"; //$NON-NLS-1$ + String ERROR_UPLOADING_FILE = "error.upload.file"; //$NON-NLS-1$ } diff --git a/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java b/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java index 3d0baf8..c63b33d 100644 --- a/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java +++ b/src/main/java/com/ibm/appscan/plugin/core/presence/CloudPresenceProvider.java @@ -145,7 +145,7 @@ private void loadPresences() { for(int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); String id = object.getString(ID); - String name = object.getString(NAME); + String name = object.getString(PRESENCE_NAME); m_presences.put(id, name); } }