/** * Creates a builder for a new {@link Order}. * * @return {@link OrderBuilder} object */ public OrderBuilder newOrder() { return new OrderBuilder(getLogin()); }
/** * Creates a builder for a new {@link Order}. * * @return {@link OrderBuilder} object */ public OrderBuilder newOrder() { return new OrderBuilder(getLogin()); }
/** * Returns an {@link Iterator} of all {@link Order} belonging to this {@link Account}. * <p> * Using the iterator will initiate one or more requests to the ACME server. * * @return {@link Iterator} instance that returns {@link Order} objects in no specific * order. {@link Iterator#hasNext()} and {@link Iterator#next()} may throw * {@link AcmeProtocolException} if a batch of authorization URIs could not be * fetched from the server. Each {@link Iterator} instance may provide the * {@link Order} objects in a different order. */ public Iterator<Order> getOrders() { URL ordersUrl = getJSON().get(KEY_ORDERS).asURL(); return new ResourceIterator<>(getLogin(), KEY_ORDERS, ordersUrl, Login::bindOrder); }
/** * Returns an {@link Iterator} of all {@link Order} belonging to this {@link Account}. * <p> * Using the iterator will initiate one or more requests to the ACME server. * * @return {@link Iterator} instance that returns {@link Order} objects in no specific * order. {@link Iterator#hasNext()} and {@link Iterator#next()} may throw * {@link AcmeProtocolException} if a batch of authorization URIs could not be * fetched from the server. Each {@link Iterator} instance may provide the * {@link Order} objects in a different order. */ public Iterator<Order> getOrders() { URL ordersUrl = getJSON().get(KEY_ORDERS).asURL(); return new ResourceIterator<>(getLogin(), KEY_ORDERS, ordersUrl, Login::bindOrder); }
/** * Commits the changes and updates the account. */ public void commit() throws AcmeException { LOG.debug("modify/commit"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); if (!editContacts.isEmpty()) { claims.put(KEY_CONTACT, editContacts); } conn.sendSignedRequest(getLocation(), claims, getLogin()); JSON json = conn.readJsonResponse(); if (json != null) { setJSON(json); } } } }
/** * Commits the changes and updates the account. */ public void commit() throws AcmeException { LOG.debug("modify/commit"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); if (!editContacts.isEmpty()) { claims.put(KEY_CONTACT, editContacts); } conn.sendSignedRequest(getLocation(), claims, getLogin()); JSON json = conn.readJsonResponse(); if (json != null) { setJSON(json); } } } }
if (Arrays.equals(getLogin().getKeyPair().getPrivate().getEncoded(), newKeyPair.getPrivate().getEncoded())) { throw new IllegalArgumentException("newKeyPair must actually be a new key pair"); payloadClaim.putKey("oldKey", getLogin().getKeyPair().getPublic()); outerClaim.put("payload", innerJws.getEncodedPayload()); conn.sendSignedRequest(keyChangeUrl, outerClaim, getLogin()); getLogin().setKeyPair(newKeyPair); } catch (JoseException ex) { throw new AcmeProtocolException("Cannot sign key-change", ex);
if (Arrays.equals(getLogin().getKeyPair().getPrivate().getEncoded(), newKeyPair.getPrivate().getEncoded())) { throw new IllegalArgumentException("newKeyPair must actually be a new key pair"); payloadClaim.putKey("oldKey", getLogin().getKeyPair().getPublic()); outerClaim.put("payload", innerJws.getEncodedPayload()); conn.sendSignedRequest(keyChangeUrl, outerClaim, getLogin()); getLogin().setKeyPair(newKeyPair); } catch (JoseException ex) { throw new AcmeProtocolException("Cannot sign key-change", ex);
/** * Permanently deactivates an account. Related certificates may still be valid after * account deactivation, and need to be revoked separately if neccessary. * <p> * A deactivated account cannot be reactivated! */ public void deactivate() throws AcmeException { LOG.debug("deactivate"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.put(KEY_STATUS, "deactivated"); conn.sendSignedRequest(getLocation(), claims, getLogin()); JSON json = conn.readJsonResponse(); if (json != null) { setJSON(json); } } }
/** * Permanently deactivates an account. Related certificates may still be valid after * account deactivation, and need to be revoked separately if neccessary. * <p> * A deactivated account cannot be reactivated! */ public void deactivate() throws AcmeException { LOG.debug("deactivate"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.put(KEY_STATUS, "deactivated"); conn.sendSignedRequest(getLocation(), claims, getLogin()); JSON json = conn.readJsonResponse(); if (json != null) { setJSON(json); } } }