metabase / saml20-clj

A Clojure SAML 2.0 library for SSO
35 stars 12 forks source link

Allow using KeyStore from a classpath resource #50

Closed zonpantli closed 3 years ago

zonpantli commented 3 years ago

It is currently not possible to package a KeyStore to a jar and load it from a classpath resource with the saml20-clj.coerce/keystore coercer like

{:alias "my-saml-secrets"
 :filename (clojure.java.io/resource "path/to/file/in/resources/keystorefile.jks")
 :password "s1krit"}

The check in saml20-clj.coerce/keystore does not work with this, as

(some-> filename io/as-file .exists)

throws IllegalArgumentException Not a file for a classpath resource.

Would it make sense to have the check as:

(when (or
        (io/resource filename)
        (some-> filename io/as-file .exists))
   ... )