/** * Gets the STAR extension's {@link Certificate} if it is available. {@code null} * otherwise. * * @since 2.6 */ @CheckForNull public Certificate getStarCertificate() { return getJSON().get("star-certificate") .map(Value::asURL) .map(getLogin()::bindCertificate) .orElse(null); }
/** * Gets the {@link Authorization} required for this order, in no specific order. */ public List<Authorization> getAuthorizations() { Login login = getLogin(); return Collections.unmodifiableList(getJSON().get("authorizations") .asArray() .stream() .map(Value::asURL) .map(login::bindAuthorization) .collect(toList())); }
/** * Gets the {@link Certificate} if it is available. {@code null} otherwise. */ @CheckForNull public Certificate getCertificate() { return getJSON().get("certificate") .map(Value::asURL) .map(getLogin()::bindCertificate) .orElse(null); }
/** * Gets the {@link Certificate} if it is available. {@code null} otherwise. */ @CheckForNull public Certificate getCertificate() { return getJSON().get("certificate") .map(Value::asURL) .map(getLogin()::bindCertificate) .orElse(null); }
/** * Gets the {@link Authorization} required for this order, in no specific order. */ public List<Authorization> getAuthorizations() { Login login = getLogin(); return Collections.unmodifiableList(getJSON().get("authorizations") .asArray() .stream() .map(Value::asURL) .map(login::bindAuthorization) .collect(toList())); }
/** * Gets the STAR extension's {@link Certificate} if it is available. {@code null} * otherwise. * * @since 2.6 */ @CheckForNull public Certificate getStarCertificate() { return getJSON().get("star-certificate") .map(Value::asURL) .map(getLogin()::bindCertificate) .orElse(null); }
/** * Finalizes the order, by providing a CSR. * <p> * After a successful finalization, the certificate is available at * {@link #getCertificate()}. * <p> * Even though the ACME protocol uses the term "finalize an order", this method is * called {@link #execute(byte[])} to avoid confusion with the general * {@link Object#finalize()} method. * * @param csr * CSR containing the parameters for the certificate being requested, in * DER format */ public void execute(byte[] csr) throws AcmeException { LOG.debug("finalize"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.putBase64("csr", csr); conn.sendSignedRequest(getFinalizeLocation(), claims, getLogin()); } invalidate(); }
/** * Finalizes the order, by providing a CSR. * <p> * After a successful finalization, the certificate is available at * {@link #getCertificate()}. * <p> * Even though the ACME protocol uses the term "finalize an order", this method is * called {@link #execute(byte[])} to avoid confusion with the general * {@link Object#finalize()} method. * * @param csr * CSR containing the parameters for the certificate being requested, in * DER format */ public void execute(byte[] csr) throws AcmeException { LOG.debug("finalize"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.putBase64("csr", csr); conn.sendSignedRequest(getFinalizeLocation(), claims, getLogin()); } invalidate(); }
/** * 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); } } }