shred / acme4j

Java client for ACME (Let's Encrypt)

Home Page:https://acme4j.shredzone.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to hold Order and Authorization for a while

xiaoxiao29 opened this issue · comments

Due to business relations, the order and authorization need to be temporarily saved.
I can get the json string with getJSON method, but how I get the object from the json string.

The JSON string only represents your current local state of the resource, so it is usually not very useful to save it.

The recommended way is to use the resource URL:

URL orderLocation = order.getLocation();
URL authLocation = authorization.getLocation();

To restore the object, use the respective bind method of Login:

Login login = ...
Order restoredOrder = login.bindOrder(orderLocation);
Authorization restoredAuth = login.bindAuthorization(authLocation);

Also see: https://shredzone.org/maven/acme4j/usage/login.html#resource-binding

If you want to temporarily store the current state (e.g. to share it between two server instances), you can also use serialization: https://shredzone.org/maven/acme4j/usage/login.html#serialization . However I recommend to share the location and use the bind methods.

Thanks. I'v got the solution.