One more set of fixes for new approach.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
[buddy.auth.backends.session :refer [session-backend]]
|
[buddy.auth.backends.session :refer [session-backend]]
|
||||||
[buddy.auth.backends.token :refer [jws-backend]]
|
[buddy.auth.backends.token :refer [jws-backend]]
|
||||||
[buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
|
[buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
|
||||||
|
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[clojure.tools.logging :as log]
|
[clojure.tools.logging :as log]
|
||||||
[compojure.core :refer [ANY context defroutes GET routes]]
|
[compojure.core :refer [ANY context defroutes GET routes]]
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
[ring.middleware.params :refer [wrap-params]]
|
[ring.middleware.params :refer [wrap-params]]
|
||||||
[ring.middleware.reload :refer [wrap-reload]]
|
[ring.middleware.reload :refer [wrap-reload]]
|
||||||
[ring.middleware.session :refer [wrap-session]]
|
[ring.middleware.session :refer [wrap-session]]
|
||||||
|
[ring.middleware.session.cookie :refer [cookie-store]]
|
||||||
[ring.util.response :as response]
|
[ring.util.response :as response]
|
||||||
[unilog.context :as lc]))
|
[unilog.context :as lc]))
|
||||||
|
|
||||||
@@ -97,9 +99,13 @@
|
|||||||
(wrap-authorization auth-backend
|
(wrap-authorization auth-backend
|
||||||
)
|
)
|
||||||
(wrap-authentication auth-backend
|
(wrap-authentication auth-backend
|
||||||
(session-backend))
|
(session-backend {:authfn (fn [auth]
|
||||||
|
(dissoc auth :exp))}))
|
||||||
|
|
||||||
(wrap-session)
|
(wrap-session {:store (ring.middleware.session.cookie/cookie-store
|
||||||
|
{:key
|
||||||
|
(byte-array
|
||||||
|
[42, 52, -31, 105, -126, -33, -118, -69, -82, -59, -15, -69, -38, 103, -102, -1])} )})
|
||||||
(wrap-reload)
|
(wrap-reload)
|
||||||
(wrap-params)
|
(wrap-params)
|
||||||
(mp/wrap-multipart-params)
|
(mp/wrap-multipart-params)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
{:status 301
|
{:status 301
|
||||||
:headers {"Location" (str "/?jwt=" jwt)}
|
:headers {"Location" (str "/?jwt=" jwt)}
|
||||||
:session {:identity auth}})
|
:session {:identity (dissoc auth :exp)}})
|
||||||
{:status 401
|
{:status 401
|
||||||
:body "Couldn't authenticate"}))
|
:body "Couldn't authenticate"}))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
|
|||||||
@@ -158,7 +158,9 @@
|
|||||||
request)
|
request)
|
||||||
(try
|
(try
|
||||||
(let [entity-id (Long/parseLong (or (some-> (:entity-id form-params) not-empty)
|
(let [entity-id (Long/parseLong (or (some-> (:entity-id form-params) not-empty)
|
||||||
(:entity-id params)))
|
(:entity-id params)
|
||||||
|
(get params "entity-id")
|
||||||
|
(get form-params "entity-id")))
|
||||||
history (->>
|
history (->>
|
||||||
(d/q '[:find ?a2 ?v (pull ?tx [:db/txInstant :audit/user :db/id]) ?ad
|
(d/q '[:find ?a2 ?v (pull ?tx [:db/txInstant :audit/user :db/id]) ?ad
|
||||||
:in $ $$ ?i
|
:in $ $$ ?i
|
||||||
|
|||||||
Reference in New Issue
Block a user