Some minor ACME compliance fixes

pull/17/merge
Richard Körber 2015-12-18 00:29:59 +01:00
parent 97d0856a04
commit 4c02421114
3 changed files with 10 additions and 2 deletions

View File

@ -66,6 +66,8 @@ public class DnsChallenge extends GenericChallenge {
if (authorization == null) {
throw new IllegalStateException("Challenge has not been authorized yet.");
}
cb.put(KEY_TYPE, getType());
cb.put(KEY_TOKEN, getToken());
cb.put(KEY_KEY_AUTHORIZSATION, authorization);
}

View File

@ -70,6 +70,8 @@ public class HttpChallenge extends GenericChallenge {
if (authorization == null) {
throw new IllegalStateException("Challenge has not been authorized yet.");
}
cb.put(KEY_TYPE, getType());
cb.put(KEY_TOKEN, getToken());
cb.put(KEY_KEY_AUTHORIZSATION, authorization);
}

View File

@ -151,6 +151,8 @@ public abstract class AbstractAcmeClient implements AcmeClient {
Map<String, Object> result = conn.readJsonResponse();
auth.setStatus((String) result.get("status"));
@SuppressWarnings("unchecked")
Collection<Map<String, Object>> challenges =
(Collection<Map<String, Object>>) result.get("challenges");
@ -194,7 +196,7 @@ public abstract class AbstractAcmeClient implements AcmeClient {
challenge.marshall(claims);
int rc = conn.sendSignedRequest(challenge.getUri(), claims, session, account);
if (rc != HttpURLConnection.HTTP_ACCEPTED) {
if (rc != HttpURLConnection.HTTP_OK && rc != HttpURLConnection.HTTP_ACCEPTED) {
conn.throwAcmeException();
}
@ -224,10 +226,12 @@ public abstract class AbstractAcmeClient implements AcmeClient {
claims.putBase64("csr", csr);
int rc = conn.sendSignedRequest(resourceUri(Resource.NEW_CERT), claims, session, account);
if (rc != HttpURLConnection.HTTP_CREATED) {
if (rc != HttpURLConnection.HTTP_CREATED && rc != HttpURLConnection.HTTP_ACCEPTED) {
conn.throwAcmeException();
}
// HTTP_ACCEPTED requires Retry-After header to be set
// Optionally returns the certificate. Currently it is just ignored.
// X509Certificate cert = conn.readCertificate();