From 3d53c0309f6036413bf06cd593c58a633546809c Mon Sep 17 00:00:00 2001 From: Daniel Szmulewicz Date: Sat, 6 Jan 2018 18:37:22 +0800 Subject: [PATCH] third try --- src/certificaat/acme4j/authorization.clj | 7 +++++-- src/certificaat/kung_fu.clj | 7 ++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/certificaat/acme4j/authorization.clj b/src/certificaat/acme4j/authorization.clj index b5815c5..caa77b7 100644 --- a/src/certificaat/acme4j/authorization.clj +++ b/src/certificaat/acme4j/authorization.clj @@ -6,7 +6,8 @@ [certificaat.acme4j.session :as session]) (:import [org.shredzone.acme4j Authorization] [org.shredzone.acme4j.challenge Http01Challenge Dns01Challenge] - org.shredzone.acme4j.Status)) + org.shredzone.acme4j.Status + org.shredzone.acme4j.exception.AcmeProtocolException)) (defn create [domain reg] (let [auth (.authorizeDomain reg domain)] @@ -22,6 +23,8 @@ (extend-type Authorization Certificaat (valid? [this] - (let [status (.getStatus this)] + (let [status (try + (.getStatus this) + (catch AcmeProtocolException e (log/warn (.getMessage e))))] (log/info "Authorization status:" status) (or (= Status/VALID status) (= Status/PENDING status))))) ; (.isBefore (.getExpires this) (Instant/now))) diff --git a/src/certificaat/kung_fu.clj b/src/certificaat/kung_fu.clj index 2a6edc9..11c7734 100644 --- a/src/certificaat/kung_fu.clj +++ b/src/certificaat/kung_fu.clj @@ -13,7 +13,6 @@ [clojure.spec.alpha :as s]) (:import java.net.URI org.shredzone.acme4j.exception.AcmeUnauthorizedException - org.shredzone.acme4j.exception.AcmeServerException org.shredzone.acme4j.Status)) (defn setup [{:keys [config-dir domain key-type key-size keypair-filename] :as options}] @@ -55,10 +54,8 @@ (let [registration (registration/restore session registration-uri)] (d/valid? registration))) ::d/authorization-uri (if-let [authorization-uri (c/load-uri frozen-resource)] - (try - (let [authorization (authorization/restore session authorization-uri)] - (d/valid? authorization)) - (catch AcmeServerException e (log/warn (.getMessage e))))) + (let [authorization (authorization/restore session authorization-uri)] + (d/valid? authorization))) ::d/certificate-uri (if-let [certificate-uri (c/load-uri frozen-resource)] (let [certificate (certificate/restore session certificate-uri)] (d/valid? certificate))))))