private Http01Challenge httpChallenge(Authorization auth) throws AcmeException { // Find a single http-01 challenge Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); if (challenge == null) { throw new AcmeException("Found no " + Http01Challenge.TYPE + " challenge, don't know what to do..."); } // Output the challenge, wait for acknowledge... log.debug("http://{}/.well-known/acme-challenge/{}", auth.getIdentifier().getDomain(), challenge.getToken()); log.debug("Content: {}", challenge.getAuthorization()); return challenge; }
contentHolder.content = challenge.getAuthorization(); if (challenge.getStatus() == Status.VALID) { return; challenge.trigger(); while (challenge.getStatus() != Status.VALID && attempts-- > 0) { if (challenge.getStatus() == Status.INVALID) { throw new AcmeException("Challenge failed... Giving up."); challenge.update(); if (challenge.getStatus() != Status.VALID) { throw new AcmeException("Failed to pass the challenge for domain " + auth.getIdentifier().getDomain() + ", ... Giving up.");
public String getAuthContent() { Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); return challenge.getAuthorization(); }
public String getToken() { Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); return challenge.getToken(); }
private CompletableFuture<Void> processChallenge(Authorization auth) { //TODO: We should DUMP EACH Challenge into it's own Runnable so we do challenges in parallel try { Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); log.info("tell remote end to trigger a call now. status="+auth.getStatus()+" domain="+auth.getDomain()+" expires="+auth.getExpires()); challenge.trigger(); log.info("status after="+auth.getStatus()); while (auth.getStatus() != Status.VALID) { //HACK for now....modify to catch RetryAfterException and schedule future Thread.sleep(3000L); log.info("reupdate status"); auth.update(); log.info("updated to status="+auth.getStatus()); } return null; } catch (AcmeException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } }
private Challenge httpChallenge(final Authorization auth) throws AcmeException { final Http01Challenge challenge = auth.findChallenge(Http01Challenge.TYPE); if (challenge == null) { throw new AcmeException("Challenge is null"); } challengeUpdater.accept("/.well-known/acme-challenge/" + challenge.getToken(), challenge.getAuthorization()); return challenge; }
/** * Prepares a HTTP challenge. * <p> * The verification of this challenge expects a file with a certain content to be * reachable at a given path under the domain to be tested. * </p> * * @param aAuthorization * {@link Authorization} to find the challenge in * @param aDomainName * Domain name to be authorized * @return {@link Challenge} to verify */ private Challenge httpChallenge(Authorization aAuthorization, String aDomainName) throws AcmeException { // Find a single http-01 challenge Http01Challenge challenge = aAuthorization.findChallenge(Http01Challenge.TYPE); if (challenge == null) { throw new AcmeException("Found no " + Http01Challenge.TYPE + " challenge, don't know what to do..."); } challengeStore.put(challenge.getToken(), challenge.getAuthorization()); return challenge; }
auth.getIdentifier().getDomain(), challenge.getToken()); LOG.info("File name: {}", challenge.getToken()); LOG.info("Content: {}", challenge.getAuthorization()); LOG.info("The file must not contain any leading or trailing whitespaces or line breaks!"); LOG.info("If you're ready, dismiss the dialog..."); .append(auth.getIdentifier().getDomain()) .append("/.well-known/acme-challenge/") .append(challenge.getToken()) .append("\n\n"); message.append("Content:\n\n"); message.append(challenge.getAuthorization()); acceptChallenge(message.toString());
try (FileOutputStream fos = new FileOutputStream(new File(challengePath, challenge1.getToken()))) { fos.write(challenge1.getAuthorization().getBytes(StandardCharsets.UTF_8));