static AcmeAccount resetAcmeAccount(AcmeAccount acmeAccount, boolean staging) { String accountUrl = acmeAccount.getAccountUrl(); if (accountUrl != null) { String stagingEndpoint = acmeAccount.getStagingServerUrl().substring(0, acmeAccount.getStagingServerUrl().indexOf("/" + DIRECTORY)); if ((accountUrl.startsWith(stagingEndpoint) && ! staging) || (! accountUrl.startsWith(stagingEndpoint) && staging)) { // need to reset the account information so it will get populated with the correct staging / non-staging account URL AcmeAccount.Builder acmeAccountBuilder = AcmeAccount.builder(); acmeAccountBuilder .setServerUrl(acmeAccount.getServerUrl()) .setStagingServerUrl(acmeAccount.getStagingServerUrl()) .setDn(acmeAccount.getDn()) .setKey(acmeAccount.getCertificate(), acmeAccount.getPrivateKey()) .setTermsOfServiceAgreed(acmeAccount.isTermsOfServiceAgreed()); if (acmeAccount.getContactUrls() != null) { acmeAccountBuilder.setContactUrls(acmeAccount.getContactUrls()); } return acmeAccountBuilder.build(); } } return acmeAccount; }
KeyStore keyStore = keyStoreInjector.getValue(); AcmeAccount.Builder acmeAccountBuilder = AcmeAccount.builder() .setServerUrl(certificateAuthority.getUrl()) .setStagingServerUrl(certificateAuthority.getStagingUrl());