@Override public Tuple2<Order, Dns01Challenge> challengeInit(String domainName) { AssertTools.assertNotNull(account, "You need to log in first"); Order order; try { order = account.newOrder() // .domains(domainName) // .create(); } catch (AcmeException e) { LOGGER.error("Could not ask for domain {}", domainName, e); throw new LetsencryptException("Could not ask for domain " + domainName, e); } // Get the DNS challenge Dns01Challenge challenge = null; List<String> availableChallenges = new ArrayList<>(); for (Authorization auth : order.getAuthorizations()) { auth.getChallenges().stream().map(it -> it.getType()).forEach(it -> availableChallenges.add(it)); challenge = auth.findChallenge(Dns01Challenge.TYPE); } if (challenge == null) { throw new LetsencryptException("DNS Challenge not found for " + domainName + " ; Available challenges are: [" + Joiner.on(", ").join(availableChallenges) + "]"); } return new Tuple2<>(order, challenge); }
/** * Adds domain names to the order. * * @param domains * Collection of domain names to be ordered. May be wildcard domains if * supported by the CA. IDN names are accepted and will be ACE encoded * automatically. * @return itself */ public OrderBuilder domains(String... domains) { for (String domain : requireNonNull(domains, "domains")) { domain(domain); } return this; }
/** * Announces that the client wishes to fetch the recurring certificate via GET * request. If not used, the STAR certificate can only be fetched via POST-as-GET * request. {@link Metadata#isStarCertificateGetAllowed()} must return {@code true} in * order for this option to work. * <p> * This option is only needed if you plan to fetch the STAR certificate via other * means than by using acme4j. * <p> * Implies {@link #recurrent()}. * * @return itself * @since 2.6 */ public OrderBuilder recurrentEnableGet() { recurrent(); this.recurrentGet = true; return this; }
/** * Creates a builder for a new {@link Order}. * * @return {@link OrderBuilder} object */ public OrderBuilder newOrder() { return new OrderBuilder(getLogin()); }
/** * Adds a domain name to the order. * * @param domain * Name of a domain to be ordered. May be a wildcard domain if supported by * the CA. IDN names are accepted and will be ACE encoded automatically. * @return itself */ public OrderBuilder domain(String domain) { return identifier(Identifier.dns(domain)); }
/** * Adds domain names to the order. * * @param domains * Collection of domain names to be ordered. May be wildcard domains if * supported by the CA. IDN names are accepted and will be ACE encoded * automatically. * @return itself */ public OrderBuilder domains(String... domains) { for (String domain : requireNonNull(domains, "domains")) { domain(domain); } return this; }
/** * Announces that the client wishes to fetch the recurring certificate via GET * request. If not used, the STAR certificate can only be fetched via POST-as-GET * request. {@link Metadata#isStarCertificateGetAllowed()} must return {@code true} in * order for this option to work. * <p> * This option is only needed if you plan to fetch the STAR certificate via other * means than by using acme4j. * <p> * Implies {@link #recurrent()}. * * @return itself * @since 2.6 */ public OrderBuilder recurrentEnableGet() { recurrent(); this.recurrentGet = true; return this; }
/** * Creates a builder for a new {@link Order}. * * @return {@link OrderBuilder} object */ public OrderBuilder newOrder() { return new OrderBuilder(getLogin()); }
/** * Adds a domain name to the order. * * @param domain * Name of a domain to be ordered. May be a wildcard domain if supported by * the CA. IDN names are accepted and will be ACE encoded automatically. * @return itself */ public OrderBuilder domain(String domain) { return identifier(Identifier.dns(domain)); }
/** * @return The list of challenges with tokens to create webpages for that remote end will call to verify we own the domain */ public CompletableFuture<ProxyOrder> placeOrder(URL accountUrl, KeyPair accountKeyPair) { try { log.info("reestablish account from location="+accountUrl+" and keypair"); Session session = new Session("acme://letsencrypt.org/staging"); Login login = session.login(accountUrl, accountKeyPair); Account account = login.getAccount(); log.info("create an order"); String domainTemp = "something.com"; Order order = account.newOrder() .domain(domainTemp) .create(); checkAuthStatii(order); List<ProxyAuthorization> auths = new ArrayList<>(); for(Authorization auth : order.getAuthorizations()) auths.add(new ProxyAuthorization(auth)); return CompletableFuture.completedFuture(new ProxyOrder(order, auths)); } catch (AcmeException e) { throw new RuntimeException(e); } }
/** * Sets the latest date of validity of the last issued certificate. If not set, the * CA's default is used. * <p> * Implies {@link #recurrent()}. * * @param end * End date of validity * @return itself * @see Metadata#getStarMaxRenewal() * @since 2.3 */ public OrderBuilder recurrentEnd(Instant end) { recurrent(); this.recurrentEnd = requireNonNull(end, "end"); return this; }
/** * Sets the earliest date of validity of the first issued certificate. If not set, * the start date is the earliest possible date. * <p> * Implies {@link #recurrent()}. * * @param start * Start date of validity * @return itself * @since 2.3 */ public OrderBuilder recurrentStart(Instant start) { recurrent(); this.recurrentStart = requireNonNull(start, "start"); return this; }
/** * Sets the earliest date of validity of the first issued certificate. If not set, * the start date is the earliest possible date. * <p> * Implies {@link #recurrent()}. * * @param start * Start date of validity * @return itself * @since 2.3 */ public OrderBuilder recurrentStart(Instant start) { recurrent(); this.recurrentStart = requireNonNull(start, "start"); return this; }
/** * Sets the maximum validity period of each certificate. If not set, the CA's * default is used. * <p> * Implies {@link #recurrent()}. * * @param duration * Duration of validity of each certificate * @return itself * @see Metadata#getStarMinCertValidity() * @since 2.3 */ public OrderBuilder recurrentCertificateValidity(Duration duration) { recurrent(); this.recurrentValidity = requireNonNull(duration, "duration"); return this; }
/** * Sets the latest date of validity of the last issued certificate. If not set, the * CA's default is used. * <p> * Implies {@link #recurrent()}. * * @param end * End date of validity * @return itself * @see Metadata#getStarMaxRenewal() * @since 2.3 */ public OrderBuilder recurrentEnd(Instant end) { recurrent(); this.recurrentEnd = requireNonNull(end, "end"); return this; }
/** * Sets the maximum validity period of each certificate. If not set, the CA's * default is used. * <p> * Implies {@link #recurrent()}. * * @param duration * Duration of validity of each certificate * @return itself * @see Metadata#getStarMinCertValidity() * @since 2.3 */ public OrderBuilder recurrentCertificateValidity(Duration duration) { recurrent(); this.recurrentValidity = requireNonNull(duration, "duration"); return this; }