                                 json/decode
                                 (get "access_token"))]
        {"Authorization" (str "bearer " access-token)
-        "Conternt-Type" "application/json"}
-       (throw
-        (ex-info "Down stream auth server timed out (Keycloak)"
-                 {:response-code 503}))))))
-
+        "Conternt-Type" "application/json"}))))
 
 (defn group-by-path
   "Get the group id (uuid) by using group path.

  (if-some [user-id (get-user-id user-id-cache email)]
    user-id
    (let [url (format "%s/users/?email=%s" api-root email)]
      (if-some [users (-> (client/get url (assoc req-opts :connection-manager cm)) :body json/decode)]
        (if-some [user-id (active-user users email)]
          (-> user-id-cache
              (swap! assoc email user-id)
              (get email))
          (throw
           (ex-info "No active user with email provided" {:response-code 401})))
        (throw
         (ex-info "Down stream auth server timed out (Keycloak)"
                  {:response-code 503}))))))

(defn allowed-paths
  "Provided an email address from the authentication process dig out the

   (let [bare-req-opts {:timeout timeout}]
     (if-some [headers (request-headers keycloak (assoc bare-req-opts :timeout timeout))]
       (let [req-opts (assoc bare-req-opts :headers headers)]
         (when-let [user-id (lookup-user-id cm req-opts api-root user-id-cache email)]
           (when-let [allowed-paths
                    (-> (client/get (format "%s/users/%s/groups" api-root user-id)
                                    (assoc req-opts :connection-manager cm)) :body json/decode)]
             (reduce (fn [paths {:strs [path]}]
                       (conj paths (subs path 12)))
                     #{}
                     allowed-paths))))))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
