Check identifier type on authorizations

pull/30/head
Richard Körber 2016-07-18 00:14:35 +02:00
parent 4c34ce8352
commit 0195e5b16c
1 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import org.shredzone.acme4j.challenge.Challenge;
import org.shredzone.acme4j.connector.Connection;
import org.shredzone.acme4j.exception.AcmeException;
import org.shredzone.acme4j.exception.AcmeNetworkException;
import org.shredzone.acme4j.exception.AcmeProtocolException;
import org.shredzone.acme4j.util.ClaimBuilder;
import org.shredzone.acme4j.util.TimestampParser;
import org.slf4j.Logger;
@ -215,6 +216,10 @@ public class Authorization extends AcmeResource {
Map<String, Object> identifier = (Map<String, Object>) json.get("identifier");
if (identifier != null) {
String type = (String) identifier.get("type");
if (type != null && !"dns".equals(type)) {
throw new AcmeProtocolException("Unknown authorization type: " + type);
}
this.domain = (String) identifier.get("value");
}