Restore "Do not send authorization with challenge"

Also set Pebble to strict mode.

This reverts commit cdab2b8bd0.
pull/61/head
Richard Körber 2018-03-18 13:54:45 +01:00
parent 3cd74220dd
commit 2ac4e7b7fb
No known key found for this signature in database
GPG Key ID: AAB9FD19C78AA3E0
6 changed files with 5 additions and 18 deletions

View File

@ -24,7 +24,6 @@ import org.jose4j.lang.JoseException;
import org.shredzone.acme4j.Login;
import org.shredzone.acme4j.exception.AcmeProtocolException;
import org.shredzone.acme4j.toolbox.JSON;
import org.shredzone.acme4j.toolbox.JSONBuilder;
/**
* An extension of {@link Challenge} that handles challenges with a {@code token} and
@ -35,7 +34,6 @@ public class TokenChallenge extends Challenge {
private static final long serialVersionUID = 1634133407432681800L;
protected static final String KEY_TOKEN = "token";
protected static final String KEY_KEY_AUTHORIZATION = "keyAuthorization";
/**
* Creates a new generic {@link TokenChallenge} object.
@ -49,12 +47,6 @@ public class TokenChallenge extends Challenge {
super(login, data);
}
@Override
protected void prepareResponse(JSONBuilder response) {
super.prepareResponse(response);
response.put(KEY_KEY_AUTHORIZATION, getAuthorization());
}
/**
* Gets the token.
*/

View File

@ -30,8 +30,6 @@ import org.shredzone.acme4j.toolbox.TestUtils;
* Unit tests for {@link Dns01Challenge}.
*/
public class DnsChallengeTest {
private static final String KEY_AUTHORIZATION =
"pNvmJivs0WCko2suV7fhe-59oFqyYx_yB7tx6kIMAyE.HnWjTDnyqlCrm6tZ-6wX-TrEXgRdeNu9G71gqxSO6o0";
private Login login = TestUtils.login();
@ -45,12 +43,12 @@ public class DnsChallengeTest {
assertThat(challenge.getType(), is(Dns01Challenge.TYPE));
assertThat(challenge.getStatus(), is(Status.PENDING));
assertThat(challenge.getDigest(), is("rzMmotrIgsithyBYc0vgiLUEEKYx0WetQRgEF2JIozA"));
assertThat(challenge.getAuthorization(), is("pNvmJivs0WCko2suV7fhe-59oFqyYx_yB7tx6kIMAyE.HnWjTDnyqlCrm6tZ-6wX-TrEXgRdeNu9G71gqxSO6o0"));
JSONBuilder response = new JSONBuilder();
challenge.prepareResponse(response);
assertThat(response.toString(), sameJSONAs("{\"keyAuthorization\"=\""
+ KEY_AUTHORIZATION + "\"}").allowingExtraUnexpectedFields());
assertThat(response.toString(), sameJSONAs("{}").allowingExtraUnexpectedFields());
}
}

View File

@ -53,8 +53,7 @@ public class HttpChallengeTest {
JSONBuilder response = new JSONBuilder();
challenge.prepareResponse(response);
assertThat(response.toString(), sameJSONAs("{\"keyAuthorization\"=\""
+ KEY_AUTHORIZATION + "\"}").allowingExtraUnexpectedFields());
assertThat(response.toString(), sameJSONAs("{}").allowingExtraUnexpectedFields());
}
/**

View File

@ -1,3 +1,2 @@
{
"keyAuthorization": "IlirfxKKXAsHtmzK29Pj8A.HnWjTDnyqlCrm6tZ-6wX-TrEXgRdeNu9G71gqxSO6o0"
}

View File

@ -2,6 +2,5 @@
"type": "http-01",
"status": "pending",
"url": "https://example.com/acme/some-location",
"token": "IlirfxKKXAsHtmzK29Pj8A",
"keyAuthorization": "XbmEGDDc2AMDArHLt5x7GxZfIRv0aScknUKlyf5S4KU.KMH_h8aGAKlY3VQqBUczm1cfo9kaovivy59rSY1xZ0E"
"token": "IlirfxKKXAsHtmzK29Pj8A"
}

View File

@ -132,7 +132,7 @@
<cmd>
<shell>
echo "nameserver $(grep 'bammbamm' /etc/hosts|cut -f1)"&gt;/etc/resolv.conf; \
pebble -config /etc/pebble/pebble-config.json
pebble -strict -config /etc/pebble/pebble-config.json
</shell>
</cmd>
<assembly>