簡體   English   中英

是否可以使用 Recaptcha 保護 Spring 引導 MVC 中的獲取請求(在 Spring 引導應用程序內)

[英]Is it possible to protect Get Requests in Spring Boot MVC with Recaptcha (inside the Spring Boot Application)

Let's say when you send a request to this url: ...?query=something&filter=another_thing , I am returning a web page with model attribute let's say model.addAttribute('result', resultList) then just for loop the result and print價值。 (Template resolver could be jsp or thymeleaf, but there is no option to load resultList without model fashion - I mean there is no ajax request - )

我想做的事:

  • 在加載結果(或加載頁面)之前,我只想先加載 google recaptcha.js 然后
  • recaptcha 將返回一個令牌,
  • 然后我將通過 ajax 請求將令牌發送到后端。
  • 畢竟如果請求不是機器人,我會打印結果列表

這個要求是否可以在 Spring 引導應用程序本身內部實現?

注意:我無論如何都找不到這樣做。 我只是認為我可以攔截原始獲取 url 然后重定向到另一個頁面,這個頁面將加載 recaptcha 並將令牌發送到我的后端。 如果不是機器人,則重定向到原始獲取 url。 但是我不知道如何保留原始請求

您的構圖略有錯誤,這可能會有所不同。

發出請求時,您要確保該請求已獲得授權,然后再進行處理。

這就是需要重新驗證的地方。為防止未經授權的訪問,請查看 spring-security 和重新驗證。

一旦獲得足夠的身份驗證,您的請求就會進入您的 controller,然后您就可以提供該頁面了。

(當然,您可以動態研究它,但這會有點困難)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM