public static SecretIdentifier fromExternalForm(String urn) {
        if (urn == null || !urnPattern.matcher(urn).matches()) {
            throw new IllegalArgumentException("Invalid external form " + urn);
        }
        String[] parts = colonPattern.split(urn, 5);
        return new SecretIdentifier(validateWithTransform(parts[4], "key"));
    }
@Test(expected = IllegalArgumentException.class)
    public void testFromExternalInvalid() {
        SecretIdentifier.fromExternalForm("urn:logstash:secret:invalid:foo");
    }