code: @Override
      public void authenticateWithBlackduck() throws IntegrationException {
          final URL securityUrl;
          try {
              securityUrl = new URL(getBaseUrl(), "j_spring_security_check");
          } catch (final MalformedURLException e) {
              throw new IntegrationException("Error constructing the login URL: " + e.getMessage(), e);
          }
  
          if (StringUtils.isNotBlank(hubUsername) && StringUtils.isNotBlank(hubPassword)) {
              final List<NameValuePair> bodyValues = new ArrayList<>();
              bodyValues.add(new BasicNameValuePair("j_username", hubUsername));
              bodyValues.add(new BasicNameValuePair("j_password", hubPassword));
              final UrlEncodedFormEntity entity = new UrlEncodedFormEntity(bodyValues, Charsets.UTF_8);
  
              final RequestBuilder requestBuilder = createRequestBuilder(HttpMethod.POST, null);
              requestBuilder.setCharset(Charsets.UTF_8);
              requestBuilder.setUri(securityUrl.toString());
              requestBuilder.setEntity(entity);
              final HttpUriRequest request = requestBuilder.build();
              logRequestHeaders(request);
              try (final CloseableHttpResponse closeableHttpResponse = getClient().execute(request)) {
                  logResponseHeaders(closeableHttpResponse);
                  final Response response = new Response(closeableHttpResponse);
                  final int statusCode = closeableHttpResponse.getStatusLine().getStatusCode();
                  final String statusMessage = closeableHttpResponse.getStatusLine().getReasonPhrase();
                  if (statusCode < RestConstants.OK_200 || statusCode >= RestConstants.MULT_CHOICE_300) {
                      final String httpResponseContent = response.getContentString();
                      throw new IntegrationRestException(statusCode, statusMessage, httpResponseContent, String.format("Connection Error: %s %s", statusCode, statusMessage));
                  } else {
                      // get the CSRF token
                      final Header csrfToken = closeableHttpResponse.getFirstHeader(RestConstants.X_CSRF_TOKEN);
                      if (csrfToken != null) {
                          addCommonRequestHeader(RestConstants.X_CSRF_TOKEN, csrfToken.getValue());
                      } else {
                          logger.error("No CSRF token found when authenticating");
                      }
                  }
              } catch (final IOException e) {
                  throw new IntegrationException(e.getMessage(), e);
              }
          }
      }
docs: Gets the cookie for the Authorized connection to the Hub server. Returns the response code from the connection.