diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/Registration.java b/acme4j-client/src/main/java/org/shredzone/acme4j/Registration.java index e57972ec..6e02e14f 100644 --- a/acme4j-client/src/main/java/org/shredzone/acme4j/Registration.java +++ b/acme4j-client/src/main/java/org/shredzone/acme4j/Registration.java @@ -49,6 +49,7 @@ public class Registration extends AcmeResource { private final List contacts = new ArrayList<>(); private URI agreement; + private Status status; /** * Creates a new instance of {@link Registration} and binds it to the {@link Session}. @@ -87,6 +88,13 @@ public class Registration extends AcmeResource { return Collections.unmodifiableList(contacts); } + /** + * Returns the current status of the registration. + */ + public Status getStatus() { + return status; + } + /** * Updates the registration to the current account status. */ @@ -283,6 +291,10 @@ public class Registration extends AcmeResource { } } + if (json.containsKey("status")) { + this.status = Status.parse((String) json.get("status")); + } + URI location = conn.getLocation(); if (location != null) { setLocation(location); diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/Status.java b/acme4j-client/src/main/java/org/shredzone/acme4j/Status.java index 14d67e65..c92d90c8 100644 --- a/acme4j-client/src/main/java/org/shredzone/acme4j/Status.java +++ b/acme4j-client/src/main/java/org/shredzone/acme4j/Status.java @@ -20,7 +20,7 @@ package org.shredzone.acme4j; */ public enum Status { - PENDING, PROCESSING, VALID, INVALID, REVOKED, DEACTIVATED, UNKNOWN; + PENDING, PROCESSING, VALID, INVALID, REVOKED, DEACTIVATED, GOOD, UNKNOWN; /** * Parses the string and returns a corresponding Status object. diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java index d4503af4..59f48fe5 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java @@ -109,6 +109,7 @@ public class RegistrationTest { assertThat(registration.getAgreement(), is(agreementUri)); assertThat(registration.getContacts(), hasSize(1)); assertThat(registration.getContacts().get(0), is(URI.create("mailto:foo2@example.com"))); + assertThat(registration.getStatus(), is(Status.GOOD)); provider.close(); } diff --git a/acme4j-client/src/test/resources/json.properties b/acme4j-client/src/test/resources/json.properties index 1365b5f3..c5b160dd 100644 --- a/acme4j-client/src/test/resources/json.properties +++ b/acme4j-client/src/test/resources/json.properties @@ -36,7 +36,8 @@ updateRegistration = \ updateRegistrationResponse = \ {"agreement":"http://example.com/agreement.pdf",\ - "contact":["mailto:foo2@example.com"]} + "contact":["mailto:foo2@example.com"],\ + "status":"good"} newAuthorizationRequest = \ {"resource":"new-authz",\