   [ctx]
   (cond-> ctx
     (not-empty (filter (comp (partial = :basic) :type) (-> ctx :http-resource :security)))
-    (assoc :authentication (:basic-authentication (ring.middleware.basic-authentication/basic-authentication-request (:request ctx) (fn [user password] {:user user :password password}))))))
-
-;; Authorization
+    (assoc :authentication
+           (:basic-authentication (ring.middleware.basic-authentication/basic-authentication-request
+                                   (:request ctx)
+                                   (fn [user password] {:user user :password password}))))))
+
 (defn authorization
   "Authorization"
   [ctx]

          ;; etag will do for the response.
          (assoc-in ctx [:response :etag]
                    (get etags (:representation ctx))))))
    ctx
    ))

(defn invoke-method
  "Methods"

                (merge
                 {:status 401 ::http-response true}
                 (when-let [basic-realm (first (sequence realms-xf (-> ctx :http-resource :security)))]
                   {:headers {"www-authenticate" (format "Basic realm=\"%s\"" basic-realm)}}))))

      (if-let [auth (service/authorization res)]
        (assoc ctx :authorization auth)
        ctx))

    (d/error-deferred (ex-info "" {:status 403 ::http-response true}))))

;; Now we do a fetch, so the resource has a chance to
;; load any metadata it may need to answer the questions
