public String getDomain() { return auth.getDomain(); }
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 void checkAuthStatii(Order order) { for(Authorization auth : order.getAuthorizations()) { Status status = auth.getStatus(); log.info("checking auth="+auth.getDomain()+" status="+status+" location="+auth.getLocation()+" expires="+auth.getExpires()); if(status != Status.PENDING) throw new ChallengeInBadStateException("challenge in bad state="+auth.getJSON()); } }
private boolean authorize(final Authorization authorization) throws AcmeException { final Challenge challenge = httpChallenge(authorization); if (challenge == null) { throw new AcmeException("HTTP challenge is null"); } if (challenge.getStatus() == Status.VALID) { return false; } challenge.trigger(); try { int attempts = config.getRetryCount(); while (challenge.getStatus() != Status.VALID && attempts-- > 0) { if (challenge.getStatus() == Status.INVALID) { throw new AcmeException("Invalid challenge status, exiting refresh iteration"); } Thread.sleep(config.getRetryTimeoutMs()); challenge.update(); } } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); } if (challenge.getStatus() != Status.VALID) { throw new AcmeException("Challenge for domain " + authorization.getDomain() + ", is invalid, exiting iteration"); } return true; }