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 {
|
||||
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_DEPRECATED = "urn:acme:error:";
|
||||
|
||||
private static final Pattern DATE_PATTERN = Pattern.compile(
|
||||
"^(\\d{4})-(\\d{2})-(\\d{2})T"
|
||||
|
@ -206,9 +205,6 @@ public final class AcmeUtils {
|
|||
* Strips the acme error prefix from the error string.
|
||||
* <p>
|
||||
* 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
|
||||
* 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) {
|
||||
if (type != null && type.startsWith(ACME_ERROR_PREFIX)) {
|
||||
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 {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,6 @@ public class AcmeUtilsTest {
|
|||
@Test
|
||||
public void testStripErrorPrefix() {
|
||||
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(null), is(nullValue()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue