              (s/validate new-login-form-schema))]
     (component/using (->LoginForm path context boilerplate) [:user-password-authorizer :http-session-store])))
 
-;; Now we can build a protection domain, composed of a login form, user
+;; Now we can build a protection system, composed of a login form, user
 ;; authorizer and session store. Different constructors can build this
 ;; component in different ways.
 
-(defrecord ProtectionDomain [protector user-password-authorizer http-session-store]
+(defrecord ProtectionSystem [protector user-password-authorizer http-session-store]
   component/Lifecycle
   (start [this] (component/start-system this (keys this)))
   (stop [this] (component/stop-system this (keys this)))
   ;; In this implementation, we export any routes provided by
   ;; sub-components. These are the routes that provide login forms and
   ;; so on, nothing to do with the routes that are protected by this
-  ;; protection domain.
+  ;; protection system.
   BidiRoutesContributor
   (routes [this] ["" (vec (keep #(when (satisfies? BidiRoutesContributor %) (routes %)) (vals this)))])
   (context [this] (or

  (add-user! [_ uid pw]
    (if (satisfies? NewUserCreator user-password-authorizer)
      (add-user! user-password-authorizer uid pw)
      (throw (ex-info "This protection domain implementation does not support the creation of new users" {})))))

(def new-default-protection-domain-schema
  {:password-file s/Any
   (s/optional-key :session-timeout-in-seconds) s/Int
   (s/optional-key :boilerplate) (s/=> 1)
   })

(defn new-default-protection-domain [& {:as opts}]
  (s/validate new-default-protection-domain-schema opts)
  (map->ProtectionDomain
   {:protector (if-let [boilerplate (:boilerplate opts)]
                 (new-login-form :boilerplate boilerplate)
                 (new-login-form))


(defn new-mandatory-protected-bidi-routes
  "Like new-protected-bidi-routes above, but the absence of
  a :protection-system dependency will cause an error."
  [routes & {:as opts}]
  (component/using
   (apply new-protected-bidi-routes routes (apply concat (seq opts)))
   [:protection-system]))
