   (testing "Jws token backend authentication"
     (let [request (make-jws-request jws-data jws-secret)
           handler (wrap-authentication identity jws-backend)
-          response (handler request)]
-      (is (= (:identity response) jws-data))))
+          request' (handler request)]
+      (is (authenticated? request'))
+      (is (= (:identity request') jws-data))))
 
   (testing "Jws token backend authentication with wrong key yields nil"
     (let [request (make-jws-request jws-data  "wrong-key")
           handler (wrap-authentication identity jws-backend)
-          response (handler request)]
-      (is (nil? (:identity response)))))
-
-  (testing "Jws token backend authentication with no token yields nil"
+          request' (handler request)]
+      (is (not (authenticated? request')))
+      (is (nil? (:identity request')))))
+
+  (testing "Jws token backend authentication without token yields nil"
     (let [request {}
           handler (wrap-authentication identity jws-backend)
-          response (handler request)]
-      (is (nil? (:identity response)))))
+          request' (handler request)]
+      (is (not (authenticated? request')))
+      (is (nil? (:identity request')))))
 
   (testing "Jws token authorizaton with wrong key yields 401"
     (let [request (make-jws-request jws-data "wrong-key")

                      (wrap-authorization backend)
                      (wrap-authentication backend))
          response (handler request)]
      (is (= (:status response) 3000)))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

                      (wrap-authorization jws-backend)
                      (wrap-authentication jws-backend))
          response (handler request)]
      (is (= (:status response) 401))
      (is (= (:body response) "Unauthorized"))))

  (testing "Jws token authorization - authenticated but unathorized thrown yields 403"
    (let [request (make-jws-request {:userid 1} jws-secret)
