Feature/search 2802 shared secret auth (#382)

* SEARCH-2802: Filter HTTP requests (now "none" and "secret" communication methods are available) from X509 Web Filter.

* SEARCH-2802: HttpClientFactory (for Repository and Search Services clients) support for Shared Secret communication.

* SEARCH-2802: Fix HttpClientFactory base unit tests.
This commit is contained in:
Angel Borroy
2021-04-14 10:25:45 +02:00
committed by GitHub
parent 2a8811a109
commit 20dd0efc6f
6 changed files with 242 additions and 103 deletions

View File

@@ -165,6 +165,8 @@
<property name="keyResourceLoader" ref="springKeyResourceLoader"/>
<property name="keyStoreParameters" ref="keyStoreParameters"/>
<property name="encryptionParameters" ref="md5EncryptionParameters"/>
<property name="sharedSecret" value="${solr.sharedSecret}"/>
<property name="sharedSecretHeader" value="${solr.sharedSecret.header}"/>
<property name="host" value="${solr.host}"/>
<property name="port" value="${solr.port}"/>
<property name="sslPort" value="${solr.port.ssl}"/>

View File

@@ -31,14 +31,16 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import java.io.UnsupportedEncodingException;
import org.alfresco.httpclient.HttpClientFactory;
import org.alfresco.httpclient.RequestHeadersHttpClient;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.util.Pair;
import org.apache.commons.codec.net.URLCodec;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,8 +48,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.beans.factory.BeanFactory;
import java.io.UnsupportedEncodingException;
/**
* @author Andy
*
@@ -64,34 +64,34 @@ public class SolrStoreMappingWrapperTest
HttpClientFactory httpClientFactory;
@Mock
HttpClient httpClientCommon;
RequestHeadersHttpClient httpClientCommon;
@Mock
HttpClient httpClient1;
RequestHeadersHttpClient httpClient1;
@Mock
HttpClient httpClient2;
RequestHeadersHttpClient httpClient2;
@Mock
HttpClient httpClient3;
RequestHeadersHttpClient httpClient3;
@Mock
HttpClient httpClient4;
RequestHeadersHttpClient httpClient4;
@Mock
HttpClient httpClient5;
RequestHeadersHttpClient httpClient5;
@Mock
HttpClient httpClient6;
RequestHeadersHttpClient httpClient6;
@Mock
HttpClient httpClient7;
RequestHeadersHttpClient httpClient7;
@Mock
HttpClient httpClient8;
RequestHeadersHttpClient httpClient8;
@Mock
HttpClient httpClient9;
RequestHeadersHttpClient httpClient9;
@Mock
HostConfiguration hostConfigurationCommon;