   (unresolve-handler [this m]
     (unresolve-handler routes m)))
 
-(defn protect [routes & {:as opts}]
-  ["" (->ProtectMatched [routes]
-                        (s/validate
-                         {:authorizer (s/protocol HttpRequestAuthorizer)
-                          (s/optional-key :fail-handler) (s/protocol FailedAuthorizationHandler)}
-                         opts))])
+(defn add-bidi-protection-wrapper [routes & {:as opts}]
+  ["" (->ProtectMatched
+       [routes]
+       (s/validate
+        {:authorizer (s/protocol HttpRequestAuthorizer)
+         (s/optional-key :fail-handler) (s/protocol FailedAuthorizationHandler)}
+        opts))])
 
 (defrecord BidiFailedAuthorizationRedirect [h]
   FailedAuthorizationHandler
   (failed-authorization [_ req]
-    (println "FAILED AUTH" (path-for (:modular.bidi/routes req) h))
-    (println "FAILED AUTH2" (:modular.bidi/routes req))
-    (println "FAILED AUH h" h)
     {:status 302
      :headers {"Location" (path-for (:modular.bidi/routes req) h)}
      :body "Not authorized\n"

  (context [this] context)

  BidiRoutesProtector
  (protect-routes [this routes]
    (println "protecting routes:" routes)
    (protect routes
             :authorizer (new-session-based-request-authorizer :http-session-store (:http-session-store this))
             :fail-handler (->BidiFailedAuthorizationRedirect (get-in this [:handlers :get-handler])))))

(def new-login-form-schema
  {(s/optional-key :path) s/Str

  structure, or a function that takes the component and returns a bidi
  route structure."  [routes context]
  (->ProtectedBidiRoutes routes context))
