toOptions() {
public static class CertificateAuthContext extends AuthContext {
String certFile;
String certPassword;
- /**
- * Creates a CertificateAuthContext by initializing the SSLContext
- * of the HTTPS channel with the SSLContext object passed. The KeyManager of
- * the SSLContext should be initialized with the appropriate client
- * certificate and client's private key
- * @param context the SSLContext with which we initialize the
- * CertificateAuthContext
- * @deprecated (as of 4.0.1) use CertificateAuthContext(SSLContext,X509TrustManager)
- */
- @Deprecated
- public CertificateAuthContext(SSLContext context) {
- this.sslContext = context;
- }
- /**
+ /**
* Creates a CertificateAuthContext by initializing the SSLContext of the
* HTTPS channel with the SSLContext object passed and using the TrustManger
* passed. The KeyManager of the SSLContext should be initialized with the
@@ -1073,23 +944,6 @@ public CertificateAuthContext(SSLContext context, X509TrustManager trustManager)
this.trustManager = trustManager;
}
- /**
- * Creates a CertificateAuthContext by initializing the SSLContext
- * of the HTTPS channel with the SSLContext object passed and assigns the
- * SSLHostnameVerifier passed to be used for checking host names. The KeyManager of
- * the SSLContext should be initialized with the appropriate client
- * certificate and client's private key
- * @param context the SSLContext with which we initialize the
- * CertificateAuthContext
- * @param verifier a callback for checking host names
- * @deprecated (as of 4.0.1) use CertificateAuthContext(SSLContext,SSLHostnameVerifier,X509TrustManager)
- */
- @Deprecated
- public CertificateAuthContext(SSLContext context, SSLHostnameVerifier verifier) {
- this.sslContext = context;
- this.sslVerifier = verifier;
- }
-
/**
* Creates a CertificateAuthContext by initializing the SSLContext of the
* HTTPS channel with the SSLContext object passed and assigns the
@@ -1109,34 +963,6 @@ public CertificateAuthContext(SSLContext context, SSLHostnameVerifier verifier,
this.trustManager = trustManager;
}
- /**
- * Creates a CertificateAuthContext with a PKCS12 file. The SSLContext is
- * created from the information in the PKCS12 file. This constructor should
- * be called when the export password of the PKCS12 file is empty.
- *
- * @param certFile the p12 file which contains the client's private key and
- * the client's certificate chain
- * @throws CertificateException if any of the certificates in the certFile
- * cannot be loaded
- * @throws UnrecoverableKeyException if the certFile has an export password
- * @throws KeyManagementException if initializing the SSLContext with the
- * KeyManager fails
- * @throws IOException if there is an I/O or format problem with the
- * keystore data, if a password is required but not given, or if
- * the given password was incorrect or if the certFile path is
- * invalid or if the file is not found If the error is due to a
- * wrong password, the cause of the IOException should be an
- * UnrecoverableKeyException.
- */
- @Deprecated
- public CertificateAuthContext(String certFile)
- throws CertificateException, IOException,
- UnrecoverableKeyException, KeyManagementException {
- this.certFile = certFile;
- this.certPassword = "";
- this.sslContext = createSSLContext();
- }
-
/**
* Creates a CertificateAuthContext with a PKCS12 file. The SSLContext is
* created from the information in the PKCS12 file. This constructor should
@@ -1167,30 +993,6 @@ public CertificateAuthContext(String certFile, X509TrustManager trustManager)
this.sslContext = createSSLContext();
}
- /**
- * Creates a CertificateAuthContext with a PKCS12 file. The SSLContext
- * is created from the information in the PKCS12 file. This constructor
- * should be called when the export password of the PKCS12 file is non-empty.
- * @param certFile the p12 file which contains the client's private key
- * and the client's certificate chain
- * @param certPassword the export password of the p12 file
- * @throws CertificateException if any of the certificates in the certFile cannot be loaded
- * @throws UnrecoverableKeyException if the certFile has an export password
- * @throws KeyManagementException if initializing the SSLContext with the KeyManager fails
- * @throws IOException if there is an I/O or format problem with the keystore data,
- * if a password is required but not given, or if the given password was
- * incorrect or if the certFile path is invalid or if the file is not found
- * If the error is due to a wrong password, the cause of the IOException
- * should be an UnrecoverableKeyException.
- */
- @Deprecated
- public CertificateAuthContext(String certFile, String certPassword)
- throws CertificateException, IOException,
- UnrecoverableKeyException, KeyManagementException {
- this.certFile = certFile;
- this.certPassword = certPassword;
- this.sslContext = createSSLContext();
- }
/**
* Creates a CertificateAuthContext with a PKCS12 file. The SSLContext
* is created from the information in the PKCS12 file. This constructor
@@ -1457,133 +1259,6 @@ static public DatabaseClient newClient(String host, int port, String basePath, S
return client;
}
-
- static private SecurityContext makeSecurityContext(String user, String password, Authentication type, SSLContext context, SSLHostnameVerifier verifier) {
- if ( Authentication.BASIC == type ) {
- return new BasicAuthContext(user, password)
- .withSSLContext(context)
- .withSSLHostnameVerifier(verifier);
- } else if ( Authentication.DIGEST == type ) {
- return new DigestAuthContext(user, password)
- .withSSLContext(context)
- .withSSLHostnameVerifier(verifier);
- } else {
- throw new IllegalStateException("makeSecurityContext should only be called with BASIC or DIGEST Authentication");
- }
- }
-
- /**
- * Creates a client to access the database by means of a REST server.
- *
- * @param host the host with the REST server
- * @param port the port for the REST server
- * @param user the user with read, write, or administrative privileges
- * @param password the password for the user
- * @param type the type of authentication applied to the request
- * @return a new client for making database requests
- * @deprecated (as of 4.0.1) use {@link #newClient(String host, int port, SecurityContext securityContext)}
- */
- @Deprecated
- static public DatabaseClient newClient(String host, int port, String user, String password, Authentication type) {
- return newClient(host, port, null, makeSecurityContext(user, password, type, null, null), null);
- }
- /**
- * Creates a client to access the database by means of a REST server.
- *
- * A data service interface can only call an endpoint for the configured content database
- * of the appserver. You cannot specify the database when constructing a client for working
- * with a data service.
- *
- * @param host the host with the REST server
- * @param port the port for the REST server
- * @param database the database to access (default: configured database for the REST server)
- * @param user the user with read, write, or administrative privileges
- * @param password the password for the user
- * @param type the type of authentication applied to the request
- * @return a new client for making database requests
- * @deprecated (as of 4.0.1) use {@link #newClient(String host, int port, String database, SecurityContext securityContext)}
- */
- @Deprecated
- static public DatabaseClient newClient(String host, int port, String database, String user, String password, Authentication type) {
- return newClient(host, port, database, makeSecurityContext(user, password, type, null, null), null);
- }
- /**
- * Creates a client to access the database by means of a REST server.
- *
- * @param host the host with the REST server
- * @param port the port for the REST server
- * @param user the user with read, write, or administrative privileges
- * @param password the password for the user
- * @param type the type of authentication applied to the request
- * @param context the SSL context for authenticating with the server
- * @return a new client for making database requests
- * @deprecated (as of 4.0.1) use {@link #newClient(String host, int port, SecurityContext securityContext)}
- */
- @Deprecated
- static public DatabaseClient newClient(String host, int port, String user, String password, Authentication type, SSLContext context) {
- return newClient(host, port, null, makeSecurityContext(user, password, type, context, SSLHostnameVerifier.COMMON), null);
- }
- /**
- * Creates a client to access the database by means of a REST server.
- *
- * A data service interface can only call an endpoint for the configured content database
- * of the appserver. You cannot specify the database when constructing a client for working
- * with a data service.
- *
- * @param host the host with the REST server
- * @param port the port for the REST server
- * @param database the database to access (default: configured database for the REST server)
- * @param user the user with read, write, or administrative privileges
- * @param password the password for the user
- * @param type the type of authentication applied to the request
- * @param context the SSL context for authenticating with the server
- * @return a new client for making database requests
- * @deprecated (as of 4.0.1) use {@link #newClient(String host, int port, String database, SecurityContext securityContext)}
- */
- @Deprecated
- static public DatabaseClient newClient(String host, int port, String database, String user, String password, Authentication type, SSLContext context) {
- return newClient(host, port, database, makeSecurityContext(user, password, type, context, SSLHostnameVerifier.COMMON), null);
- }
- /**
- * Creates a client to access the database by means of a REST server.
- *
- * @param host the host with the REST server
- * @param port the port for the REST server
- * @param user the user with read, write, or administrative privileges
- * @param password the password for the user
- * @param type the type of authentication applied to the request
- * @param context the SSL context for authenticating with the server
- * @param verifier a callback for checking hostnames
- * @return a new client for making database requests
- * @deprecated (as of 4.0.1) use {@link #newClient(String host, int port, SecurityContext securityContext)}
- */
- @Deprecated
- static public DatabaseClient newClient(String host, int port, String user, String password, Authentication type, SSLContext context, SSLHostnameVerifier verifier) {
- return newClient(host, port, null, makeSecurityContext(user, password, type, context, verifier), null);
- }
- /**
- * Creates a client to access the database by means of a REST server.
- *
- * A data service interface can only call an endpoint for the configured content database
- * of the appserver. You cannot specify the database when constructing a client for working
- * with a data service.
- *
- * @param host the host with the REST server
- * @param port the port for the REST server
- * @param database the database to access (default: configured database for the REST server)
- * @param user the user with read, write, or administrative privileges
- * @param password the password for the user
- * @param type the type of authentication applied to the request
- * @param context the SSL context for authenticating with the server
- * @param verifier a callback for checking hostnames
- * @return a new client for making database requests
- * @deprecated (as of 4.0.1) use {@link #newClient(String host, int port, String database, SecurityContext securityContext)}
- */
- @Deprecated
- static public DatabaseClient newClient(String host, int port, String database, String user, String password, Authentication type, SSLContext context, SSLHostnameVerifier verifier) {
- return newClient(host, port, database, makeSecurityContext(user, password, type, context, verifier), null);
- }
-
/**
* Returns the default registry with factories for creating handles
* as adapters for IO representations. To create custom registries,
@@ -1642,24 +1317,6 @@ static public void removeConfigurators() {
/**
* A Database Client Factory Bean provides an object for specifying configuration
* before creating a client to make database requests.
- *
- * For instance, a Spring configuration file might resemble the following
- * example:
- *
- * <bean name="databaseClientFactory"
- * class="com.marklogic.client.DatabaseClientFactory.Bean">
- * <property name="host" value="localhost"/>
- * <property name="port" value="8012"/>
- * <property name="user" value="rest-writer-user"/>
- * <property name="password" value="rest-writer-password"/>
- * <property name="authenticationValue" value="digest"/>
- * </bean>
- *
- * <bean name="databaseClient"
- * class="com.marklogic.client.DatabaseClient"
- * factory-bean="databaseClientFactory"
- * factory-method="newClient"/>
- *
*/
static public class Bean implements Serializable {
private static final long serialVersionUID = 1L;
@@ -1668,18 +1325,10 @@ static public class Bean implements Serializable {
private int port;
private String basePath;
private String database;
- private String user;
- private String password;
- private Authentication authentication;
- private String externalName;
private DatabaseClient.ConnectionType connectionType;
-
transient private SecurityContext securityContext;
transient private HandleFactoryRegistry handleRegistry =
HandleFactoryRegistryImpl.newDefault();
- transient private SSLContext context;
- transient private SSLHostnameVerifier verifier;
-
/**
* Zero-argument constructor for bean applications. Other
@@ -1744,96 +1393,6 @@ public void setBasePath(String basePath) {
}
/**
- * Returns the user authentication for clients created with a
- * DatabaseClientFactory.Bean object.
- * @return the user
- * @deprecated (as of 4.0.1) use SecurityContext.getUser() with BasicAuthContext or DigestAuthContext
- */
- @Deprecated
- public String getUser() {
- return user;
- }
- /**
- * Specifies the user authentication for clients created with a
- * DatabaseClientFactory.Bean object.
- * @param user the user
- * @deprecated (as of 4.0.1) use constructors for BasicAuthContext or DigestAuthContext
- */
- @Deprecated
- public void setUser(String user) {
- this.user = user;
- }
- /**
- * Returns the password authentication for clients created with a
- * DatabaseClientFactory.Bean object.
- * @return the password
- * @deprecated (as of 4.0.1) use SecurityContext.getUser() with BasicAuthContext or DigestAuthContext
- */
- @Deprecated
- public String getPassword() {
- return password;
- }
- /**
- * Specifies the password authentication for clients created with a
- * DatabaseClientFactory.Bean object.
- * @param password the password
- * @deprecated (as of 4.0.1) use constructors for BasicAuthContext or DigestAuthContext
- */
- @Deprecated
- public void setPassword(String password) {
- this.password = password;
- }
- /**
- * Returns the external name for Kerberos clients created with a
- * DatabaseClientFactory.Bean object.
- * @return the external name
- * @deprecated (as of 6.1.0, though has never had any impact)
- */
- @Deprecated
- public String getExternalName() {
- return externalName;
- }
- /**
- * Specifies the external name for Kerberos clients created with a
- * DatabaseClientFactory.Bean object.
- * @param externalName the external name
- * @deprecated (as of 6.1.0, though has never had any impact)
- */
- @Deprecated
- public void setExternalName(String externalName) {
- this.externalName = externalName;
- }
- /**
- * Returns the authentication type for clients created with a
- * DatabaseClientFactory.Bean object.
- * @return the authentication type
- * @deprecated (as of 4.0.1) use instanceof on any SecurityContext to get its type
- */
- @Deprecated
- public Authentication getAuthentication() {
- return authentication;
- }
- /**
- * Specifies the authentication type for clients created with a
- * DatabaseClientFactory.Bean object.
- * @param authentication the authentication type
- * @deprecated (as of 4.0.1) use constructor for any SecurityContext
- */
- @Deprecated
- public void setAuthentication(Authentication authentication) {
- this.authentication = authentication;
- }
- /**
- * Specifies the authentication type for clients created with a
- * DatabaseClientFactory.Bean object based on a string value.
- * @param authentication the authentication type
- * @deprecated (as of 4.0.1) use constructor for any SecurityContext
- */
- @Deprecated
- public void setAuthenticationValue(String authentication) {
- this.authentication = Authentication.valueOfUncased(authentication);
- }
- /**
* Returns the database for clients created with a
* DatabaseClientFactory.Bean object.
* @return the database
@@ -1854,48 +1413,6 @@ public String getDatabase() {
public void setDatabase(String database) {
this.database = database;
}
- /**
- * Returns the SSLContext for SSL clients created with a
- * DatabaseClientFactory.Bean object.
- * @return the SSL context
- * @deprecated (as of 4.0.1) use SecurityContext.getSSLContext()
- */
- @Deprecated
- public SSLContext getContext() {
- return context;
- }
- /**
- * Specifies the SSLContext for clients created with a
- * DatabaseClientFactory.Bean object that authenticate with SSL.
- * @param context the SSL context
- * @deprecated (as of 4.0.1) use SecurityContext.withSSLContext(SSLContext,X509TrustManager)
- */
- @Deprecated
- public void setContext(SSLContext context) {
- this.context = context;
- }
- /**
- * Returns the host verifier for clients created with a
- * DatabaseClientFactory.Bean object.
- * @return the host verifier
- * @deprecated (as of 4.0.1) use SecurityContext.getSSLHostnameVerifier()
- */
- @Deprecated
- public SSLHostnameVerifier getVerifier() {
- return verifier;
- }
- /**
- * Specifies the host verifier for clients created with a
- * DatabaseClientFactory.Bean object that verify hosts for
- * additional security.
- * @param verifier the host verifier
- * @deprecated (as of 4.0.1) use SecurityContext.setSSLHostnameVerifier(SSLHostnameVerifier)
- * or SecurityContext.withSSLHostnameVerifier(SSLHostnameVerifier)
- */
- @Deprecated
- public void setVerifier(SSLHostnameVerifier verifier) {
- this.verifier = verifier;
- }
/**
* Returns the security context for clients created with a
* DatabaseClientFactory.Bean object - BasicAuthContext, DigestAuthContext
@@ -1965,9 +1482,7 @@ public void registerDefaultHandles() {
*/
public DatabaseClient newClient() {
DatabaseClientImpl client = (DatabaseClientImpl) DatabaseClientFactory.newClient(
- host, port, basePath, database,
- (securityContext != null ? securityContext : makeSecurityContext(user, password, authentication, context, verifier)),
- connectionType);
+ host, port, basePath, database, securityContext, connectionType);
client.setHandleRegistry(getHandleRegistry().copy());
return client;
}
diff --git a/marklogic-client-api/src/test/resources/boot-test-cygwin.sh b/marklogic-client-api/src/test/resources/boot-test-cygwin.sh
deleted file mode 100644
index cfa400450..000000000
--- a/marklogic-client-api/src/test/resources/boot-test-cygwin.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-DEFAULT_M2=$USERPROFILE/.m2/repository
-M2_REPO=${1:-$DEFAULT_M2}
-
-java -cp "target/test-classes;target/classes;$M2_REPO/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar;$M2_REPO/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar;$M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar;$M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar" com.marklogic.client.test.util.TestServerBootstrapper
diff --git a/marklogic-client-api/src/test/resources/boot-test.sh b/marklogic-client-api/src/test/resources/boot-test.sh
deleted file mode 100755
index 48f785b51..000000000
--- a/marklogic-client-api/src/test/resources/boot-test.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-DEFAULT_M2=$HOME/.m2/repository
-M2_REPO=${1:-$DEFAULT_M2}
-
-java -cp target/test-classes:target/classes:$M2_REPO/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar:$M2_REPO/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar:$M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:$M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar com.marklogic.client.test.util.TestServerBootstrapper
diff --git a/marklogic-client-api/src/test/resources/teardown-test-cygwin.sh b/marklogic-client-api/src/test/resources/teardown-test-cygwin.sh
deleted file mode 100644
index b1ab470ea..000000000
--- a/marklogic-client-api/src/test/resources/teardown-test-cygwin.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-DEFAULT_M2=$USERPROFILE/.m2/repository
-M2_REPO=${1:-$DEFAULT_M2}
-
-java -cp "target/test-classes;target/classes;$M2_REPO/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar;$M2_REPO/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar;$M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar;$M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar" com.marklogic.client.test.util.TestServerBootstrapper teardown
-
diff --git a/marklogic-client-api/src/test/resources/teardown-test.sh b/marklogic-client-api/src/test/resources/teardown-test.sh
deleted file mode 100644
index 1515ae1d5..000000000
--- a/marklogic-client-api/src/test/resources/teardown-test.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-DEFAULT_M2=$HOME/.m2/repository
-M2_REPO=${1:-$DEFAULT_M2}
-
-java -cp target/test-classes:target/classes:$M2_REPO/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar:$M2_REPO/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar:$M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:$M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar com.marklogic.client.test.util.TestServerBootstrapper teardown
-