some changes to allow a hack to get rid of the ssl cert for local store since users won't have that in first set up to check

This commit is contained in:
Timothy Prepscius 2013-09-29 20:19:42 -04:00
parent 588bfd41f3
commit 8d95e79ab1
4 changed files with 26 additions and 4 deletions

View File

@ -21,13 +21,13 @@ import core.util.HttpDelegate;
import core.util.JSON_; import core.util.JSON_;
import core.util.LogNull; import core.util.LogNull;
import core.util.Strings; import core.util.Strings;
import core.util.XML;
public class ConnectorMvStore extends AsyncStoreConnectorHelper public class ConnectorMvStore extends AsyncStoreConnectorHelper
{ {
static LogNull log = new LogNull(S3Connector.class); static LogNull log = new LogNull(S3Connector.class);
final int LOCK_INTERVAL = 10 * 1000; final int LOCK_INTERVAL = 10 * 1000;
String endpointOverride = null;
ClientInfoMvStore info; ClientInfoMvStore info;
HttpDelegate httpDelegate; HttpDelegate httpDelegate;
@ -36,6 +36,9 @@ public class ConnectorMvStore extends AsyncStoreConnectorHelper
protected String createUrlPrefix () protected String createUrlPrefix ()
{ {
if (endpointOverride != null)
return endpointOverride;
return "https://" + info.getBucketEndpoint() + "/"; return "https://" + info.getBucketEndpoint() + "/";
} }
@ -112,6 +115,11 @@ public class ConnectorMvStore extends AsyncStoreConnectorHelper
setKey (info.getSecretKey()); setKey (info.getSecretKey());
} }
public void setEndpointOverride(String endpoint)
{
this.endpointOverride = endpoint;
}
long toVersionFromString (String s) throws Exception long toVersionFromString (String s) throws Exception
{ {
HashSha256 hash = new HashSha256(); HashSha256 hash = new HashSha256();

View File

@ -134,4 +134,9 @@ public class ConnectorMvStore implements StoreConnector
CallbackSync sync = new CallbackSync(connector.ensureDirectories_(folders)).invoke(); CallbackSync sync = new CallbackSync(connector.ensureDirectories_(folders)).invoke();
return sync.<Boolean>exportNoException(); return sync.<Boolean>exportNoException();
} }
public void setEndpointOverride(String endpoint)
{
connector.setEndpointOverride(endpoint);
}
} }

View File

@ -11,7 +11,8 @@ public class ConstantsClient
public static final String ATHOST = "@" + HOST; public static final String ATHOST = "@" + HOST;
public static final String WEB_SERVER_URL = "https://" + WEB_HOST; public static final String WEB_SERVER_URL = "https://" + WEB_HOST;
public static final String SERVER_TOMCAT = TOMCAT_HOST + "/Mailiverse/"; public static final String TOMCAT_URL_PORTION = "/Mailiverse/";
public static final String SERVER_TOMCAT = TOMCAT_HOST + TOMCAT_URL_PORTION;
public static final String WEB_SERVER_TOMCAT = "https://" + SERVER_TOMCAT; public static final String WEB_SERVER_TOMCAT = "https://" + SERVER_TOMCAT;
public static final String KEY_AUTH_HOST = AUTH_HOST; public static final String KEY_AUTH_HOST = AUTH_HOST;

View File

@ -9,6 +9,7 @@ import core.connector.mv.ClientInfoMvStore;
import core.connector.mv.sync.ConnectorMvStore; import core.connector.mv.sync.ConnectorMvStore;
import core.connector.sync.EncryptedStoreConnector; import core.connector.sync.EncryptedStoreConnector;
import core.connector.sync.StoreConnector; import core.connector.sync.StoreConnector;
import core.constants.ConstantsClient;
import core.constants.ConstantsStorage; import core.constants.ConstantsStorage;
import core.crypt.CryptorRSAAES; import core.crypt.CryptorRSAAES;
import core.crypt.CryptorRSAFactoryEnvironment; import core.crypt.CryptorRSAFactoryEnvironment;
@ -23,10 +24,17 @@ public class MailetHandlerMvStore extends MailetHandlerDefault
public StoreConnector createConnector (Environment e) throws Exception public StoreConnector createConnector (Environment e) throws Exception
{ {
log.debug("createConnector"); log.debug("createConnector");
ConnectorMvStore connector =
new ConnectorMvStore(new ClientInfoMvStore(e.childEnvironment(ConstantsStorage.HANDLER_MV)));
// this is a really dirty hack getting around that when you install
// using a fake key set (your first install,
connector.setEndpointOverride("http://127.0.0.1" + ConstantsClient.TOMCAT_URL_PORTION);
return new EncryptedStoreConnector( return new EncryptedStoreConnector(
new CryptorRSAAES(CryptorRSAFactoryEnvironment.create(e)), new CryptorRSAAES(CryptorRSAFactoryEnvironment.create(e)),
new ConnectorMvStore(new ClientInfoMvStore(e.childEnvironment(ConstantsStorage.HANDLER_MV))) connector
); );
} }
} }