use of org.shredzone.acme4j.challenge.Challenge in project meecrowave by apache.
the class LetsEncryptReloadLifecycle method authorize.
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.getIdentifier() + ", is invalid, exiting iteration");
}
return true;
}
Aggregations