【问题标题】:How to disable CSRF token for specific endpoints(URLs) with Ring in Clojure?如何在 Clojure 中使用 Ring 禁用特定端点(URL)的 CSRF 令牌?
【发布时间】:2017-09-29 08:38:21
【问题描述】:

我有一个具有CSRF 保护的网络应用程序,但我需要为某些endpoints(public APIs) 禁用此保护,以便我可以毫无问题地发送Rest 呼叫。

这是我的代码:

(def handler (-> route.all/routes
                 log-middleware
                 (wrap-defaults site-defaults);;which provides CSRF protection
                 wrap-exceptions
                 wrap-reload
                 wrap-gzip))

(defn start
  [port]
  (jetty/run-jetty handler {:port port}))

PS:我使用 Liberator 和 Ring

【问题讨论】:

    标签: clojure csrf compojure ring liberator


    【解决方案1】:

    感谢 James Reeves,他已通过 here

    回答了这个问题

    【讨论】:

      猜你喜欢
      • 2017-07-20
      • 2020-11-22
      • 2015-07-22
      • 2019-02-04
      • 2016-03-20
      • 2018-09-22
      • 2013-12-24
      • 2014-04-26
      • 2013-12-03
      相关资源
      最近更新 更多