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; }
throw new AcmeException("No challenge found"); while (challenge.getStatus() != Status.VALID && attempts-- > 0) { if (challenge.getStatus() == Status.INVALID) { throw new AcmeException("Challenge failed... Giving up."); throw new AcmeException("Failed to pass the challenge for domain " + auth.getIdentifier().getDomain() + ", ... Giving up.");
while (order.getStatus() != Status.VALID && attempts-- > 0) { if (order.getStatus() == Status.INVALID) { throw new AcmeException("Order failed... Giving up.");
/** * Presents the instructions for preparing the challenge validation, and waits for * dismissal. If the user cancelled the dialog, an exception is thrown. * * @param message * Instructions to be shown in the dialog */ public void acceptChallenge(String message) throws AcmeException { int option = JOptionPane.showConfirmDialog(null, message, "Prepare Challenge", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.CANCEL_OPTION) { throw new AcmeException("User cancelled the challenge"); } }
/** * Presents the user a link to the Terms of Service, and asks for confirmation. If the * user denies confirmation, an exception is thrown. * * @param agreement * {@link URI} of the Terms of Service */ public void acceptAgreement(URI agreement) throws AcmeException { int option = JOptionPane.showConfirmDialog(null, "Do you accept the Terms of Service?\n\n" + agreement, "Accept ToS", JOptionPane.YES_NO_OPTION); if (option == JOptionPane.NO_OPTION) { throw new AcmeException("User did not accept Terms of Service"); } }
/** * Gets the {@link URL} of the given {@link Resource}. This may involve connecting to * the server and getting a directory. The result is cached. * * @param resource * {@link Resource} to get the {@link URL} of * @return {@link URL} of the resource * @throws AcmeException * if the server does not offer the {@link Resource} */ public URL resourceUrl(Resource resource) throws AcmeException { readDirectory(); URL result = resourceMap.get().get(Objects.requireNonNull(resource, "resource")); if (result == null) { throw new AcmeException("Server does not offer " + resource.path()); } return result; }
/** * Gets the {@link URL} of the given {@link Resource}. This may involve connecting to * the server and getting a directory. The result is cached. * * @param resource * {@link Resource} to get the {@link URL} of * @return {@link URL} of the resource * @throws AcmeException * if the server does not offer the {@link Resource} */ public URL resourceUrl(Resource resource) throws AcmeException { readDirectory(); URL result = resourceMap.get().get(Objects.requireNonNull(resource, "resource")); if (result == null) { throw new AcmeException("Server does not offer " + resource.path()); } return result; }
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; }
throw new AcmeException("Found no " + Dns01Challenge.TYPE + " challenge, don't know what to do...");
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; }
String contentType = AcmeUtils.getContentType(conn.getHeaderField(CONTENT_TYPE_HEADER)); if (!"application/problem+json".equals(contentType)) { throw new AcmeException("HTTP " + conn.getResponseCode() + ": " + conn.getResponseMessage());
String contentType = AcmeUtils.getContentType(conn.getHeaderField(CONTENT_TYPE_HEADER)); if (!"application/problem+json".equals(contentType)) { throw new AcmeException("HTTP " + conn.getResponseCode() + ": " + conn.getResponseMessage());
/** * 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; }
throw new AcmeException("Server does not allow certificate revocation");
throw new AcmeException("Server does not allow certificate revocation");
throw new AcmeException("Server does not allow certificate revocation");
throw new AcmeException("Server does not allow certificate revocation");
/** * Cancels a recurrent order. * * @since 2.3 */ public void cancelRecurrent() throws AcmeException { if (!getSession().getMetadata().isStarEnabled()) { throw new AcmeException("CA does not support short-term automatic renewals"); } LOG.debug("cancel"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.put("status", "canceled"); conn.sendSignedRequest(getLocation(), claims, getLogin()); JSON json = conn.readJsonResponse(); if (json != null) { setJSON(json); } } }
/** * Cancels a recurrent order. * * @since 2.3 */ public void cancelRecurrent() throws AcmeException { if (!getSession().getMetadata().isStarEnabled()) { throw new AcmeException("CA does not support short-term automatic renewals"); } LOG.debug("cancel"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.put("status", "canceled"); conn.sendSignedRequest(getLocation(), claims, getLogin()); JSON json = conn.readJsonResponse(); if (json != null) { setJSON(json); } } }
return outerClaim.toMap(); } catch (JoseException ex) { throw new AcmeException("Could not create external account binding", ex);