   (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?

        [amazonica.aws.s3]
        [amazonica.aws.s3transfer :exclude [upload]])
  (:gen-class))

(defn ok [d] {:status 200 :body d})
(defn bad-request [d] {:status 400 :body d})


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

