mirror of https://github.com/shred/acme4j
Return registration status
parent
7eb2fe5945
commit
7eec503d55
|
@ -49,6 +49,7 @@ public class Registration extends AcmeResource {
|
||||||
|
|
||||||
private final List<URI> contacts = new ArrayList<>();
|
private final List<URI> contacts = new ArrayList<>();
|
||||||
private URI agreement;
|
private URI agreement;
|
||||||
|
private Status status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of {@link Registration} and binds it to the {@link Session}.
|
* 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);
|
return Collections.unmodifiableList(contacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current status of the registration.
|
||||||
|
*/
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the registration to the current account 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();
|
URI location = conn.getLocation();
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
setLocation(location);
|
setLocation(location);
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.shredzone.acme4j;
|
||||||
*/
|
*/
|
||||||
public enum Status {
|
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.
|
* Parses the string and returns a corresponding Status object.
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class RegistrationTest {
|
||||||
assertThat(registration.getAgreement(), is(agreementUri));
|
assertThat(registration.getAgreement(), is(agreementUri));
|
||||||
assertThat(registration.getContacts(), hasSize(1));
|
assertThat(registration.getContacts(), hasSize(1));
|
||||||
assertThat(registration.getContacts().get(0), is(URI.create("mailto:foo2@example.com")));
|
assertThat(registration.getContacts().get(0), is(URI.create("mailto:foo2@example.com")));
|
||||||
|
assertThat(registration.getStatus(), is(Status.GOOD));
|
||||||
|
|
||||||
provider.close();
|
provider.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ updateRegistration = \
|
||||||
|
|
||||||
updateRegistrationResponse = \
|
updateRegistrationResponse = \
|
||||||
{"agreement":"http://example.com/agreement.pdf",\
|
{"agreement":"http://example.com/agreement.pdf",\
|
||||||
"contact":["mailto:foo2@example.com"]}
|
"contact":["mailto:foo2@example.com"],\
|
||||||
|
"status":"good"}
|
||||||
|
|
||||||
newAuthorizationRequest = \
|
newAuthorizationRequest = \
|
||||||
{"resource":"new-authz",\
|
{"resource":"new-authz",\
|
||||||
|
|
Loading…
Reference in New Issue