adding authorization

This commit is contained in:
Bryce Covert
2018-07-10 20:16:26 -07:00
parent d87ebbbfe4
commit dd9b7ce86e
6 changed files with 27 additions and 9 deletions

View File

@@ -3,6 +3,7 @@
[auto-ap.routes.utils :refer [wrap-secure wrap-spec]]
[auto-ap.entities.companies :as entity]
[auto-ap.graphql :as ql]
[buddy.auth :refer [throw-unauthorized]]
[clojure.edn :as edn]
[compojure.core :refer [GET PUT context defroutes
wrap-routes]]))
@@ -12,6 +13,8 @@
(wrap-routes
(context "/graphql" []
(GET "/" {:keys [query-params] :as r}
(when (= "none" (:role (:identity r)))
(throw-unauthorized))
(let [variables (some-> (query-params "variables")
edn/read-string)]