              (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

                         (or (:session-timeout-in-seconds opts)
                             10))}))

;; Now that we have a protection domain, we want the ability to create
;; bidi routes components that can be protected by simply declaring a dependency upon the protection domain component.

(defrecord ProtectedBidiRoutes [routes context]
  component/Lifecycle
  (start [this]
    (let [protector (get-in this [:protection-domain :protector])
          routes (cond-> routes
                         (fn? routes) (apply [this])
                         protector ((partial protect-bidi-routes protector)))]

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

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

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