mirror of
https://github.com/shred/acme4j.git
synced 2025-12-16 11:24:01 +08:00
Add SSL.com provider
This commit is contained in:
committed by
Richard Körber
parent
48c32f612d
commit
9c6eb5e610
@@ -37,5 +37,6 @@ module org.shredzone.acme4j {
|
||||
provides org.shredzone.acme4j.provider.AcmeProvider
|
||||
with org.shredzone.acme4j.provider.GenericAcmeProvider,
|
||||
org.shredzone.acme4j.provider.letsencrypt.LetsEncryptAcmeProvider,
|
||||
org.shredzone.acme4j.provider.sslcom.SslComAcmeProvider,
|
||||
org.shredzone.acme4j.provider.pebble.PebbleAcmeProvider;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* acme4j - Java ACME client
|
||||
*
|
||||
* Copyright (C) 2015 Richard "Shred" Körber
|
||||
* http://acme4j.shredzone.org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
package org.shredzone.acme4j.provider.sslcom;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.provider.AbstractAcmeProvider;
|
||||
import org.shredzone.acme4j.provider.AcmeProvider;
|
||||
|
||||
/**
|
||||
* An {@link AcmeProvider} for <em>SSL.com</em>.
|
||||
* <p>
|
||||
* The {@code serverUri} is {@code "acme://ssl.com"} for the production server,
|
||||
* and {@code "acme://acme-try.ssl.com"} for a testing server.
|
||||
* <p>
|
||||
* If you want to use <em>SSL.com</em>, always prefer to use this provider.
|
||||
*
|
||||
* @see <a href="https://ssl.com/">SSL.com</a>
|
||||
*/
|
||||
public class SslComAcmeProvider extends AbstractAcmeProvider {
|
||||
|
||||
private static final String V02_DIRECTORY_URL = "https://acme.ssl.com/sslcom-dv-ecc";
|
||||
private static final String STAGING_DIRECTORY_URL = "https://acme-try.ssl.com/sslcom-dv-ecc";
|
||||
|
||||
@Override
|
||||
public boolean accepts(URI serverUri) {
|
||||
return "acme".equals(serverUri.getScheme())
|
||||
&& "ssl.com".equals(serverUri.getHost());
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL resolve(URI serverUri) {
|
||||
var path = serverUri.getPath();
|
||||
String directoryUrl;
|
||||
if (path == null || "".equals(path) || "/".equals(path) || "/v02".equals(path)) {
|
||||
directoryUrl = V02_DIRECTORY_URL;
|
||||
} else if ("/staging".equals(path)) {
|
||||
directoryUrl = STAGING_DIRECTORY_URL;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown URI " + serverUri);
|
||||
}
|
||||
|
||||
try {
|
||||
return new URL(directoryUrl);
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new AcmeProtocolException(directoryUrl, ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* acme4j - Java ACME client
|
||||
*
|
||||
* Copyright (C) 2020 Richard "Shred" Körber
|
||||
* http://acme4j.shredzone.org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This package contains the SSL.com
|
||||
* {@link org.shredzone.acme4j.provider.AcmeProvider}.
|
||||
*
|
||||
* @see <a href="https://ssl.com/">SSL.com</a>
|
||||
*/
|
||||
@ReturnValuesAreNonnullByDefault
|
||||
@DefaultAnnotationForParameters(NonNull.class)
|
||||
@DefaultAnnotationForFields(NonNull.class)
|
||||
package org.shredzone.acme4j.provider.sslcom;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.DefaultAnnotationForFields;
|
||||
import edu.umd.cs.findbugs.annotations.DefaultAnnotationForParameters;
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
import edu.umd.cs.findbugs.annotations.ReturnValuesAreNonnullByDefault;
|
||||
@@ -4,3 +4,6 @@ org.shredzone.acme4j.provider.letsencrypt.LetsEncryptAcmeProvider
|
||||
|
||||
# Pebble (ACME Test Server): https://github.com/letsencrypt/pebble
|
||||
org.shredzone.acme4j.provider.pebble.PebbleAcmeProvider
|
||||
|
||||
# SSL.com: https://ssl.com
|
||||
org.shredzone.acme4j.provider.sslcom.SslComAcmeProvider
|
||||
|
||||
Reference in New Issue
Block a user