Search in sources :

Example 1 with Http01Challenge

use of org.shredzone.acme4j.challenge.Http01Challenge in project webpieces by deanhiller.

the class AcmeClientProxy method processChallenge.

private XFuture<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.getIdentifier().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 | InterruptedException e) {
        throw SneakyThrow.sneak(e);
    }
}
Also used : Http01Challenge(org.shredzone.acme4j.challenge.Http01Challenge) AcmeException(org.shredzone.acme4j.exception.AcmeException)

Example 2 with Http01Challenge

use of org.shredzone.acme4j.challenge.Http01Challenge in project meecrowave by apache.

the class LetsEncryptReloadLifecycle method httpChallenge.

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;
}
Also used : Http01Challenge(org.shredzone.acme4j.challenge.Http01Challenge) AcmeException(org.shredzone.acme4j.exception.AcmeException)

Aggregations

Http01Challenge (org.shredzone.acme4j.challenge.Http01Challenge)2 AcmeException (org.shredzone.acme4j.exception.AcmeException)2