Skip to content

Commit

Permalink
third try
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsz committed Jan 6, 2018
1 parent 3a30dc2 commit 3d53c03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/certificaat/acme4j/authorization.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)))
7 changes: 2 additions & 5 deletions src/certificaat/kung_fu.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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}]
Expand Down Expand Up @@ -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))))))
Expand Down

0 comments on commit 3d53c03

Please sign in to comment.