private void common(CommonServicesContext services, ChangesContext changes, JunitResource resource) { if (!alwaysUpdate) { return; } List<JunitResource> junitResources = services.getResourceService().resourceFindAll(services.getResourceService().createResourceQuery(JunitResource.class)); if (junitResources.size() < 3) { for (int i = 0; i < 5; ++i) { changes.resourceAdd(new JunitResource(SecureRandomTools.randomHexString(10))); } } else { JunitResource update = junitResources.get(0); JunitResource refresh = junitResources.get(1); JunitResource delete = junitResources.get(2); update.setDate(new Date()); changes.resourceUpdate(update); changes.resourceRefresh(refresh); changes.resourceDelete(delete); } }
@Override protected void commonHandlerExecute(CommonServicesContext services, ChangesContext changes, CommonMethodUpdateEventHandlerContext<LetsencryptConfig> context) { LetsencryptConfig resource = context.getResource(); boolean update = false; // accountKeypairPem if (Strings.isNullOrEmpty(resource.getAccountKeypairPem())) { logger.info("Generating an AccountKeypair"); AsymmetricKeys keys = RSACrypt.RSA_CRYPT.generateKeyPair(4096); String accountPem = RSACrypt.RSA_CRYPT.savePrivateKeyPemAsString(keys) + RSACrypt.RSA_CRYPT.savePublicKeyPemAsString(keys); resource.setAccountKeypairPem(accountPem); update = true; } // tagName if (Strings.isNullOrEmpty(resource.getTagName())) { logger.info("Generating a Tag name"); resource.setTagName("letsencrypt_" + SecureRandomTools.randomHexString(10).toLowerCase()); update = true; } // Update if changed if (update) { changes.resourceUpdate(resource); } }
String dnsWaitDomain = "z" + SecureRandomTools.randomHexString(5).toLowerCase() + config.getDnsUpdatedSubDomain(); logger.info("Adding the DNS Wait domain {}", dnsWaitDomain);
mariaDBServer.setRootPassword(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true);
mariaDBServer.setRootPassword(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true);
mongoDBServer.setRootPassword(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true);
postgreSqlServer.setRootPassword(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true);
infraConfig.setApplicationId(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setLoginCookieSignatureSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setLoginCsrfSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setUiCsrfSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setUiLoginCookieSignatureSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true);
infraConfig.setApplicationId(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setLoginCookieSignatureSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setLoginCsrfSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setUiCsrfSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true); infraConfig.setUiLoginCookieSignatureSalt(SecureRandomTools.randomHexString(25)); context.setRequestUpdateResource(true);