   (route/resources "/")
   (route/not-found "Not Found"))
 
-(def auth-backend (jwe-backend {:secret config/token-secret
+(def auth-backend (jwe-backend {:secret secret
                                 :options {:alg :a256kw :enc :a128gcm}}))
 
 (defn basic-authenticated?


(defn login
  [request]
  (let [username (get-in request [:body :username])
        password (get-in request [:body :password])
        valid? (some-> authdata
                       (get (keyword username))
                       (= password))]
    (if valid?
      (let [claims {:user (keyword username)
                    :exp (time/plus (time/now) (time/seconds 3600))}
            token (jwe/encrypt claims config/token-secret {:alg :a256kw :enc :a128gcm})]
        (ok {:token token}))
      (bad-request {:message "wrong auth data"}))))


                             [ssl :refer [wrap-ssl-redirect wrap-forwarded-scheme]])
            [hiccup.core :as h]
            [clj-time.core :as time]
            [buddy.sign.jwt :as jwt]
            [buddy.sign.jwe :as jwe]
            [buddy.core.nonce :as nonce]
            [buddy.auth :refer [authenticated? throw-unauthorized]]
            [buddy.auth.backends.token :refer [jwe-backend]]
            [buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
