code: protected void attachSecurityInfo(HttpRequestBase request) throws IOException, URISyntaxException {
          if (!SECURITY_ENDPOINT_DOES_NOT_EXIST.equals(securityToken)) {
              try {
                  if (securityToken == null) {
                      HttpGet httpGet = new HttpGet(getWsapiUrl() + SECURITY_TOKEN_URL);
                      httpGet.addHeader(BasicScheme.authenticate(credentials, "utf-8", false));
                      GetResponse getResponse = new GetResponse(doRequest(httpGet));
                      JsonObject operationResult = getResponse.getObject();
                      JsonPrimitive securityTokenPrimitive = operationResult.getAsJsonPrimitive(SECURITY_TOKEN_KEY);
                      securityToken = securityTokenPrimitive.getAsString();
                  }
                  request.setURI(new URIBuilder(request.getURI()).addParameter(SECURITY_TOKEN_PARAM_KEY, securityToken).build());
              } catch (IOException e) {
                  //swallow the exception in this case as url does not exist indicates running and old version of
                  //ALM without the security endpoint
                  securityToken = SECURITY_ENDPOINT_DOES_NOT_EXIST;
              }
          }
      }
docs: Attach the security token parameter to the request.
  
  Response Structure:
  {"OperationResult": {"SecurityToken": "UUID"}}
  
  @param request the request to be modified
  @throws IOException if a non-200 response code is returned or if some other
  problem occurs while executing the request
  @throws URISyntaxException if there is a problem with the url in the request