mirror of https://github.com/shred/acme4j
Remove support for deprecated urn:acme:error prefix
parent
76ccb4587c
commit
be6b511085
|
@ -40,7 +40,6 @@ import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||||
public final class AcmeUtils {
|
public final class AcmeUtils {
|
||||||
private static final char[] HEX = "0123456789abcdef".toCharArray();
|
private static final char[] HEX = "0123456789abcdef".toCharArray();
|
||||||
private static final String ACME_ERROR_PREFIX = "urn:ietf:params:acme:error:";
|
private static final String ACME_ERROR_PREFIX = "urn:ietf:params:acme:error:";
|
||||||
private static final String ACME_ERROR_PREFIX_DEPRECATED = "urn:acme:error:";
|
|
||||||
|
|
||||||
private static final Pattern DATE_PATTERN = Pattern.compile(
|
private static final Pattern DATE_PATTERN = Pattern.compile(
|
||||||
"^(\\d{4})-(\\d{2})-(\\d{2})T"
|
"^(\\d{4})-(\\d{2})-(\\d{2})T"
|
||||||
|
@ -206,9 +205,6 @@ public final class AcmeUtils {
|
||||||
* Strips the acme error prefix from the error string.
|
* Strips the acme error prefix from the error string.
|
||||||
* <p>
|
* <p>
|
||||||
* For example, for "urn:ietf:params:acme:error:conflict", "conflict" is returned.
|
* For example, for "urn:ietf:params:acme:error:conflict", "conflict" is returned.
|
||||||
* <p>
|
|
||||||
* This method also handles the deprecated prefix "urn:acme:error:" that is still in
|
|
||||||
* use at Let's Encrypt.
|
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* Error type to strip the prefix from. {@code null} is safe.
|
* Error type to strip the prefix from. {@code null} is safe.
|
||||||
|
@ -217,8 +213,6 @@ public final class AcmeUtils {
|
||||||
public static String stripErrorPrefix(String type) {
|
public static String stripErrorPrefix(String type) {
|
||||||
if (type != null && type.startsWith(ACME_ERROR_PREFIX)) {
|
if (type != null && type.startsWith(ACME_ERROR_PREFIX)) {
|
||||||
return type.substring(ACME_ERROR_PREFIX.length());
|
return type.substring(ACME_ERROR_PREFIX.length());
|
||||||
} else if (type != null && type.startsWith(ACME_ERROR_PREFIX_DEPRECATED)) {
|
|
||||||
return type.substring(ACME_ERROR_PREFIX_DEPRECATED.length());
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,6 @@ public class AcmeUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testStripErrorPrefix() {
|
public void testStripErrorPrefix() {
|
||||||
assertThat(stripErrorPrefix("urn:ietf:params:acme:error:unauthorized"), is("unauthorized"));
|
assertThat(stripErrorPrefix("urn:ietf:params:acme:error:unauthorized"), is("unauthorized"));
|
||||||
assertThat(stripErrorPrefix("urn:acme:error:deprecated"), is("deprecated"));
|
|
||||||
assertThat(stripErrorPrefix("urn:somethingelse:error:message"), is(nullValue()));
|
assertThat(stripErrorPrefix("urn:somethingelse:error:message"), is(nullValue()));
|
||||||
assertThat(stripErrorPrefix(null), is(nullValue()));
|
assertThat(stripErrorPrefix(null), is(nullValue()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue