 
 (defprotocol HttpRequestAuthenticator
   ;; Return a map, potentially containing entries to be merged with the request.
-  (allowed-request? [_ request]))
+  (authenticate-request [_ request]))
 
 (extend-protocol HttpRequestAuthenticator
   Boolean
-  (allowed-request? [this request]
+  (authenticate-request [this request]
     (when this {})))
 
 (defprotocol UserAuthenticator


(defrecord SessionBasedRequestAuthenticator [http-session-store user-roles]
  HttpRequestAuthenticator
  (allowed-request? [_ request]
    (when-let [session (get-session http-session-store (:cookies (cookies-request request)))]
      {:session session ; retain compatibility with Ring's wrap-session
       ::session session


(defrecord CompositeDisjunctiveRequestAuthenticator [delegates]
  HttpRequestAuthenticator
  (authenticate-request [_ request]
    (some #(authenticate-request % request) delegates)))

(defn new-composite-disjunctive-request-authenticator [& delegates]
  (->CompositeDisjunctiveRequestAuthenticator (s/validate [(s/protocol HttpRequestAuthenticator)] delegates)))
