 (ns modular.entrance
   (:require
    [bidi.bidi :as bidi :refer (path-for resolve-handler unresolve-handler ->WrapMiddleware)]
-   [modular.bidi :refer (BidiRoutesContributor routes context)]
+   [modular.bidi :as modbidi :refer (BidiRoutesContributor routes context)]
    [schema.core :as s]
    [ring.middleware.cookies :refer (wrap-cookies)]
    [ring.middleware.params :refer (wrap-params)]

(defprotocol FailedAuthorizationHandler
  (failed-authorization [_ request]))

;; Only users with valid credentials are allowed through a checkpoint.
(defprotocol BidiRouteProtector
  (protect-routes [_ routes]))

(defn wrap-authorization
  "Ring middleware to pre-authorize a request through an authorizer. If

  (routes [this] (:routes this))
  (context [this] context)

  BidiRoutesProtector
  (protect-routes [this routes]
    (println "protecting routes:" routes)
    (protect routes
