Skip to content

Commit

Permalink
Replace the Base64 encoding of the basic auth value from the javax.xm…
Browse files Browse the repository at this point in the history
…l.DatatypeConverter (removed in Java/JDK 9) to java.util.Base64, allows Aleph to be compatible with JDK 9
  • Loading branch information
jeremiegrodziski committed Nov 22, 2017
1 parent c334be5 commit b4a49a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/aleph/http/client_middleware.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[clojure.edn :as edn])
(:import
[java.io InputStream ByteArrayOutputStream]
[java.util Base64]
[java.net URL URLEncoder UnknownHostException]))

;; Cheshire is an optional dependency, so we check for it at compile time.
Expand Down Expand Up @@ -417,9 +418,7 @@
(str (first basic-auth) ":" (second basic-auth)))
bytes (.getBytes ^String basic-auth "UTF-8")]
(str "Basic "
(-> ^String basic-auth
(.getBytes "UTF-8")
javax.xml.bind.DatatypeConverter/printBase64Binary))))
(.encodeToString (Base64/getEncoder) (.getBytes ^String basic-auth "UTF-8")))))

(defn wrap-basic-auth
"Middleware converting the :basic-auth option into an Authorization header."
Expand Down

0 comments on commit b4a49a8

Please sign in to comment.