diff --git a/advanced/composing_routers.html b/advanced/composing_routers.html index 9d66ab7b..cbcb49d6 100644 --- a/advanced/composing_routers.html +++ b/advanced/composing_routers.html @@ -1176,7 +1176,7 @@ diff --git a/advanced/configuring_routers.html b/advanced/configuring_routers.html index d9d7c4be..1fb640d2 100644 --- a/advanced/configuring_routers.html +++ b/advanced/configuring_routers.html @@ -890,7 +890,7 @@ diff --git a/advanced/dev_workflow.html b/advanced/dev_workflow.html index a22b2abd..d0164f15 100644 --- a/advanced/dev_workflow.html +++ b/advanced/dev_workflow.html @@ -941,7 +941,7 @@ diff --git a/advanced/different_routers.html b/advanced/different_routers.html index 1c269d16..54d23f16 100644 --- a/advanced/different_routers.html +++ b/advanced/different_routers.html @@ -889,7 +889,7 @@ diff --git a/advanced/route_validation.html b/advanced/route_validation.html index 4b6c4c06..0fd28f7f 100644 --- a/advanced/route_validation.html +++ b/advanced/route_validation.html @@ -977,7 +977,7 @@ diff --git a/advanced/shared_routes.html b/advanced/shared_routes.html index b412e09d..e1d6815e 100644 --- a/advanced/shared_routes.html +++ b/advanced/shared_routes.html @@ -898,7 +898,7 @@ diff --git a/basics/error_messages.html b/basics/error_messages.html index 063bc748..aa7d3992 100644 --- a/basics/error_messages.html +++ b/basics/error_messages.html @@ -865,7 +865,7 @@ diff --git a/basics/name_based_routing.html b/basics/name_based_routing.html index 2762b30c..e09e2684 100644 --- a/basics/name_based_routing.html +++ b/basics/name_based_routing.html @@ -900,7 +900,7 @@ diff --git a/basics/path_based_routing.html b/basics/path_based_routing.html index d3c825a0..52b91cc4 100644 --- a/basics/path_based_routing.html +++ b/basics/path_based_routing.html @@ -858,7 +858,7 @@ diff --git a/basics/route_conflicts.html b/basics/route_conflicts.html index e6af2641..75e06ad2 100644 --- a/basics/route_conflicts.html +++ b/basics/route_conflicts.html @@ -914,7 +914,7 @@ diff --git a/basics/route_data.html b/basics/route_data.html index 4374b788..5b5d56f4 100644 --- a/basics/route_data.html +++ b/basics/route_data.html @@ -952,7 +952,7 @@ diff --git a/basics/route_data_validation.html b/basics/route_data_validation.html index aa1decb7..e5a819c7 100644 --- a/basics/route_data_validation.html +++ b/basics/route_data_validation.html @@ -929,7 +929,7 @@ diff --git a/basics/route_syntax.html b/basics/route_syntax.html index d58c935f..33ce59df 100644 --- a/basics/route_syntax.html +++ b/basics/route_syntax.html @@ -936,7 +936,7 @@ diff --git a/basics/router.html b/basics/router.html index 18b4af6d..f86e01bf 100644 --- a/basics/router.html +++ b/basics/router.html @@ -912,7 +912,7 @@ diff --git a/coercion/clojure_spec_coercion.html b/coercion/clojure_spec_coercion.html index c98f2a6c..5671ac3f 100644 --- a/coercion/clojure_spec_coercion.html +++ b/coercion/clojure_spec_coercion.html @@ -923,7 +923,7 @@ diff --git a/coercion/coercion.html b/coercion/coercion.html index 69594eac..1630c8e5 100644 --- a/coercion/coercion.html +++ b/coercion/coercion.html @@ -966,7 +966,7 @@ diff --git a/coercion/data_spec_coercion.html b/coercion/data_spec_coercion.html index dc7a82c4..6d1a3c31 100644 --- a/coercion/data_spec_coercion.html +++ b/coercion/data_spec_coercion.html @@ -864,7 +864,7 @@ diff --git a/coercion/schema_coercion.html b/coercion/schema_coercion.html index 067ba699..63f377e1 100644 --- a/coercion/schema_coercion.html +++ b/coercion/schema_coercion.html @@ -865,7 +865,7 @@ diff --git a/development.html b/development.html index 3dc8d4a2..938d0b12 100644 --- a/development.html +++ b/development.html @@ -856,7 +856,7 @@ lein test diff --git a/faq.html b/faq.html index 5a3c7124..615640e3 100644 --- a/faq.html +++ b/faq.html @@ -936,7 +936,7 @@ diff --git a/frontend/basics.html b/frontend/basics.html index c0213d24..9ecd4dd1 100644 --- a/frontend/basics.html +++ b/frontend/basics.html @@ -853,7 +853,7 @@ React breaking due to errors.

diff --git a/frontend/browser.html b/frontend/browser.html index 91cf8e0b..bacc9a89 100644 --- a/frontend/browser.html +++ b/frontend/browser.html @@ -876,7 +876,7 @@ go back or forwards, but calling History API functions directly should work:

diff --git a/frontend/controllers.html b/frontend/controllers.html index 4bc47da6..133d15c4 100644 --- a/frontend/controllers.html +++ b/frontend/controllers.html @@ -933,7 +933,7 @@ missing resources.

diff --git a/http/default_interceptors.html b/http/default_interceptors.html index 26d04f1a..0ee9cece 100644 --- a/http/default_interceptors.html +++ b/http/default_interceptors.html @@ -855,7 +855,7 @@ diff --git a/http/interceptors.html b/http/interceptors.html index 55a5196e..9326c962 100644 --- a/http/interceptors.html +++ b/http/interceptors.html @@ -883,7 +883,7 @@ diff --git a/http/pedestal.html b/http/pedestal.html index 013e8b5a..8d5c61f7 100644 --- a/http/pedestal.html +++ b/http/pedestal.html @@ -894,7 +894,7 @@ diff --git a/http/sieppari.html b/http/sieppari.html index 42bf908a..2bf3bb6c 100644 --- a/http/sieppari.html +++ b/http/sieppari.html @@ -895,7 +895,7 @@ diff --git a/http/transforming_interceptor_chain.html b/http/transforming_interceptor_chain.html index b043358a..3c355184 100644 --- a/http/transforming_interceptor_chain.html +++ b/http/transforming_interceptor_chain.html @@ -894,7 +894,7 @@ diff --git a/index.html b/index.html index 6c278096..c615421a 100644 --- a/index.html +++ b/index.html @@ -959,7 +959,7 @@ diff --git a/performance.html b/performance.html index c195688c..23597893 100644 --- a/performance.html +++ b/performance.html @@ -942,7 +942,7 @@ diff --git a/ring/RESTful_form_methods.html b/ring/RESTful_form_methods.html index 0b775ec1..ef3955ba 100644 --- a/ring/RESTful_form_methods.html +++ b/ring/RESTful_form_methods.html @@ -860,7 +860,7 @@ This is so that our middleware is applied before reitit matches the request with diff --git a/ring/coercion.html b/ring/coercion.html index f6ee136f..297ed424 100644 --- a/ring/coercion.html +++ b/ring/coercion.html @@ -1061,7 +1061,7 @@ diff --git a/ring/compiling_middleware.html b/ring/compiling_middleware.html index 90b95540..889f12dd 100644 --- a/ring/compiling_middleware.html +++ b/ring/compiling_middleware.html @@ -923,7 +923,7 @@ diff --git a/ring/content_negotiation.html b/ring/content_negotiation.html index 85f79ca8..d0a3475e 100644 --- a/ring/content_negotiation.html +++ b/ring/content_negotiation.html @@ -946,7 +946,7 @@ Server: Jetty(9.2.21.v20170120) diff --git a/ring/data_driven_middleware.html b/ring/data_driven_middleware.html index 4551cf39..15d1998f 100644 --- a/ring/data_driven_middleware.html +++ b/ring/data_driven_middleware.html @@ -921,7 +921,7 @@ diff --git a/ring/default_handler.html b/ring/default_handler.html index cc4e4fe2..0e39e24d 100644 --- a/ring/default_handler.html +++ b/ring/default_handler.html @@ -899,7 +899,7 @@ diff --git a/ring/default_middleware.html b/ring/default_middleware.html index a15673d1..bf6fc102 100644 --- a/ring/default_middleware.html +++ b/ring/default_middleware.html @@ -878,7 +878,7 @@ diff --git a/ring/dynamic_extensions.html b/ring/dynamic_extensions.html index e2875ccc..942cfcec 100644 --- a/ring/dynamic_extensions.html +++ b/ring/dynamic_extensions.html @@ -794,9 +794,9 @@ (require '[clojure.set :as set]) (defn wrap-enforce-roles [handler] - (fn [{::keys [roles] :as request}] + (fn [{:keys [my-roles] :as request}] (let [required (some-> request (ring/get-match) :data ::roles)] - (if (and (seq required) (not (set/subset? required roles))) + (if (and (seq required) (not (set/subset? required my-roles))) {:status 403, :body "forbidden"} (handler request))))) @@ -821,7 +821,7 @@ ; {:status 403, :body "forbidden"}

Authorized access to guarded route:

-
(app {:request-method :get, :uri "/api/admin/ping", ::roles #{:admin}})
+
(app {:request-method :get, :uri "/api/admin/ping", :my-roles #{:admin}})
 ; {:status 200, :body "ok"}
 

Dynamic extensions are nice, but we can do much better. See data-driven middleware and compiling routes.

@@ -868,7 +868,7 @@ diff --git a/ring/middleware_registry.html b/ring/middleware_registry.html index d985e476..c7570c0d 100644 --- a/ring/middleware_registry.html +++ b/ring/middleware_registry.html @@ -879,7 +879,7 @@ diff --git a/ring/reverse_routing.html b/ring/reverse_routing.html index c4a737a3..3c21f549 100644 --- a/ring/reverse_routing.html +++ b/ring/reverse_routing.html @@ -864,7 +864,7 @@ diff --git a/ring/ring.html b/ring/ring.html index 7912db33..372bade3 100644 --- a/ring/ring.html +++ b/ring/ring.html @@ -1008,7 +1008,7 @@ diff --git a/ring/route_data_validation.html b/ring/route_data_validation.html index b07afaae..a3c15dcd 100644 --- a/ring/route_data_validation.html +++ b/ring/route_data_validation.html @@ -1076,7 +1076,7 @@ diff --git a/ring/slash_handler.html b/ring/slash_handler.html index fa1e0346..15b4e3dc 100644 --- a/ring/slash_handler.html +++ b/ring/slash_handler.html @@ -902,7 +902,7 @@ diff --git a/ring/static.html b/ring/static.html index f1ab1bd9..ad184d14 100644 --- a/ring/static.html +++ b/ring/static.html @@ -904,7 +904,7 @@ diff --git a/ring/swagger.html b/ring/swagger.html index e6b4346c..a28effa0 100644 --- a/ring/swagger.html +++ b/ring/swagger.html @@ -888,6 +888,7 @@

We use swagger-ui from ring-swagger-ui, which can be easily configured from routing application. It stores files swagger-ui in the resource classpath.

Webjars also hosts a version of the swagger-ui.

NOTE: Currently, swagger-ui module is just for Clojure. ClojureScript-support welcome as a PR!

+

NOTE: If you want to use swagger-ui 2.x you can do so by explicitly downgrading metosin/ring-swagger-ui to 2.2.10.

Examples

Simple example