 
 (defn- make-login-handlers [opts]
   (let [p (promise)]
-    @(deliver p {:get-handler (new-login-get-handler p :post-handler)
-                 :post-handler (wrap-params (new-login-post-handler p :get-handler opts))})))
-
-;; TODO If a LoginForm component is injected with a login form renderer component, that could be used
-
-(defrecord LoginForm [path context]
+    @(deliver p {:get-handler (new-login-get-handler p :post-handler (select-keys opts [:boilerplate]))
+                 :post-handler (wrap-params (new-login-post-handler p :get-handler (select-keys opts [:authorizer :http-session-store])))})))
+
+(defrecord LoginForm [path context boilerplate]
   component/Lifecycle
   (start [this]
-    (let [handlers (make-login-handlers (select-keys this [:authorizer :http-session-store]))]
+    (let [handlers (make-login-handlers (select-keys this [:authorizer :http-session-store :boilerplate]))]
       (assoc this
         :handlers handlers
         :routes [path (->WrapMiddleware


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

(defn new-login-form [& {:as opts}]
  (let [{:keys [path context]}
        (->> opts
             (merge {:context ""
                     :path "/login"})
             (s/validate new-login-form-schema))]
    (component/using (->LoginForm path context) [:authorizer :http-session-store])))

;; Now we can build a protection domain, composed of a login form, user
;; authorizer and session store. Different constructors can build this

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

