mirror of https://github.com/shred/acme4j
Review URI/URL use
parent
0156907773
commit
3ce832d83e
|
@ -234,7 +234,7 @@ public class DefaultConnection implements Connection {
|
|||
Problem problem = new Problem(readJsonResponse(), conn.getURL().toURI());
|
||||
throw createAcmeException(problem);
|
||||
} catch (URISyntaxException ex) {
|
||||
throw new AcmeProtocolException("Bad request URI: " + conn.getURL(), ex);
|
||||
throw new AcmeProtocolException("Bad request URL: " + conn.getURL(), ex);
|
||||
} catch (IOException ex) {
|
||||
throw new AcmeNetworkException(ex);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Properties;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A generic HTTP connector. It connects to the given URI with a 10 seconds connection and
|
||||
* A generic HTTP connector. It connects to the given URL with a 10 seconds connection and
|
||||
* read timeout.
|
||||
* <p>
|
||||
* Subclasses may reconfigure the {@link HttpURLConnection} and pin it to a concrete SSL
|
||||
|
|
|
@ -60,7 +60,7 @@ public interface AcmeProvider {
|
|||
Connection connect();
|
||||
|
||||
/**
|
||||
* Returns the provider's directory. The structure must contain resource URIs, and may
|
||||
* Returns the provider's directory. The structure must contain resource URLs, and may
|
||||
* optionally contain metadata.
|
||||
* <p>
|
||||
* The default implementation resolves the server URI and fetches the directory via
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.junit.Test;
|
|||
*/
|
||||
public class LetsEncryptAcmeProviderTest {
|
||||
|
||||
private static final String V01_DIRECTORY_URI = "https://acme-v01.api.letsencrypt.org/directory";
|
||||
private static final String STAGING_DIRECTORY_URI = "https://acme-staging.api.letsencrypt.org/directory";
|
||||
private static final String V01_DIRECTORY_URL = "https://acme-v01.api.letsencrypt.org/directory";
|
||||
private static final String STAGING_DIRECTORY_URL = "https://acme-staging.api.letsencrypt.org/directory";
|
||||
|
||||
/**
|
||||
* Tests if the provider accepts the correct URIs.
|
||||
|
@ -53,10 +53,10 @@ public class LetsEncryptAcmeProviderTest {
|
|||
public void testResolve() throws URISyntaxException {
|
||||
LetsEncryptAcmeProvider provider = new LetsEncryptAcmeProvider();
|
||||
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org")), is(url(V01_DIRECTORY_URI)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org/")), is(url(V01_DIRECTORY_URI)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org/v01")), is(url(V01_DIRECTORY_URI)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org/staging")), is(url(STAGING_DIRECTORY_URI)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org")), is(url(V01_DIRECTORY_URL)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org/")), is(url(V01_DIRECTORY_URL)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org/v01")), is(url(V01_DIRECTORY_URL)));
|
||||
assertThat(provider.resolve(new URI("acme://letsencrypt.org/staging")), is(url(STAGING_DIRECTORY_URL)));
|
||||
|
||||
try {
|
||||
provider.resolve(new URI("acme://letsencrypt.org/v99"));
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ClientTest {
|
|||
Certificate certificate = order.getCertificate();
|
||||
|
||||
LOG.info("Success! The certificate for domains " + domains + " has been generated!");
|
||||
LOG.info("Certificate URI: " + certificate.getLocation());
|
||||
LOG.info("Certificate URL: " + certificate.getLocation());
|
||||
|
||||
// Write a combined file containing the certificate and chain.
|
||||
try (FileWriter fw = new FileWriter(DOMAIN_CHAIN_FILE)) {
|
||||
|
@ -174,7 +174,7 @@ public class ClientTest {
|
|||
* created.
|
||||
* <p>
|
||||
* This is a simple way of finding your {@link Account}. A better way is to get
|
||||
* the URI of your new account with {@link Account#getLocation()} and store
|
||||
* the URL of your new account with {@link Account#getLocation()} and store
|
||||
* it somewhere. If you need to get access to your account later, reconnect to it via
|
||||
* {@link Account#bind(Session, URI)} by using the stored location.
|
||||
*
|
||||
|
@ -190,7 +190,7 @@ public class ClientTest {
|
|||
}
|
||||
|
||||
Account acct = new AccountBuilder().agreeToTermsOfService().create(session);
|
||||
LOG.info("Registered a new user, URI: " + acct.getLocation());
|
||||
LOG.info("Registered a new user, URL: " + acct.getLocation());
|
||||
|
||||
return acct;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
_acme4j_ should support any CA providing an ACME server.
|
||||
|
||||
It is always possible to connect to an ACME server by passing in the CA's resource directory URI:
|
||||
It is always possible to connect to an ACME server by passing in the CA's resource directory URL:
|
||||
|
||||
```java
|
||||
Session session =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# ACME Provider
|
||||
|
||||
Basically, it is possible to connect to any kind of ACME server just by connecting to the URI of its directory resource:
|
||||
Basically, it is possible to connect to any kind of ACME server just by connecting to the URL of its directory resource:
|
||||
|
||||
```java
|
||||
Session session = new Session("https://acme-v02.api.letsencrypt.org/directory", accountKeyPair);
|
||||
|
@ -43,4 +43,4 @@ In your `AcmeProvider` implementation, override the `createChallenge(Session, St
|
|||
|
||||
## No directory service
|
||||
|
||||
To modify the directory of an ACME server, or use a static directory, override the `directory(Session, URI)` method, and return a `JSON` of all available resources and their respective URI.
|
||||
To modify the directory of an ACME server, or use a static directory, override the `directory(Session, URI)` method, and return a `JSON` of all available resources and their respective URL.
|
||||
|
|
Loading…
Reference in New Issue