@Override public void challengeComplete(Dns01Challenge challenge) { AssertTools.assertNotNull(account, "You need to log in first"); // Trigger the challenge try { LOGGER.info("Triggering the challenge"); challenge.trigger(); } catch (AcmeException e) { LOGGER.error("Problem triggering the challenge", e); throw new LetsencryptException("Problem triggering the challenge: " + challenge.getError().getDetail(), e); } // Wait until completed while (challenge.getStatus() != Status.VALID) { if (challenge.getStatus() == Status.INVALID) { throw new LetsencryptException("The challenge failed: " + challenge.getError().getDetail()); } ThreadTools.sleep(5 * 1000); // 5 secs try { LOGGER.info("Updating the status"); challenge.update(); } catch (AcmeException e) { LOGGER.error("Problem updating the challenge status", e); throw new LetsencryptException("Problem updating the challenge status: " + challenge.getError().getDetail(), e); } LOGGER.info("Current status: {}", challenge.getStatus()); } }
/** * Returns the value as {@link Problem}. * * @param baseUrl * Base {@link URL} to resolve relative links against */ public Problem asProblem(URL baseUrl) { required(); return new Problem(asObject(), baseUrl); }
/** * Returns the error type. */ public URI getType() { return problem.getType(); }
/** * Creates a new {@link AcmeServerException}. * * @param problem * {@link Problem} that caused the exception */ public AcmeServerException(Problem problem) { super(Objects.requireNonNull(problem).toString()); this.problem = problem; }
/** * Returns the {@link URL} of a document that gives instructions on the actions to * be taken by a human. */ public URL getInstance() { URI instance = getProblem().getInstance(); if (instance == null) { throw new AcmeProtocolException("Instance URL required, but missing."); } try { return instance.toURL(); } catch (MalformedURLException ex) { throw new AcmeProtocolException("Bad instance URL: " + instance.toString(), ex); } }
messages.add("Authorization failed: " + challenge.getError().getDetail()); throw new AcmeException("Challenge failed...");
/** * Returns the value as {@link Problem}. * * @param baseUrl * Base {@link URL} to resolve relative links against */ public Problem asProblem(URL baseUrl) { required(); return new Problem(asObject(), baseUrl); }
/** * Returns the error type. */ public URI getType() { return problem.getType(); }
/** * Creates a new {@link AcmeServerException}. * * @param problem * {@link Problem} that caused the exception */ public AcmeServerException(Problem problem) { super(Objects.requireNonNull(problem).toString()); this.problem = problem; }
/** * Returns the {@link URL} of a document that gives instructions on the actions to * be taken by a human. */ public URL getInstance() { URI instance = getProblem().getInstance(); if (instance == null) { throw new AcmeProtocolException("Instance URL required, but missing."); } try { return instance.toURL(); } catch (MalformedURLException ex) { throw new AcmeProtocolException("Bad instance URL: " + instance.toString(), ex); } }