English 中文(简体)
用户请求的可靠性如何 。 get header (“ Referer” ) ;
原标题:How reliable is to user request.getHeader("Referer");

我正研究Spring-MVC的应用程序, 并且必须处理一个使用个案,

i 以 HTTP Refer 信头如 HTTP 引用器 信头出现

final String refer = request.getHeader("Referer");

但在做了一些研究 & amp; D 之后,我发现了各种线索,指出 < code> Refererer < /code> 不可靠,防火墙和好浏览器可以阻拦它,使我的应用程序无法正常运行。

是否有其他方法可以实现这一点? 或者在春天,我怎样才能从用户来处获得有关地址( URL) 的信息, 这样我就可以在某个地方保存它, 一旦用户成功登录, 就可以检索它。 我在 Spring 安全系统中看到过类似的功能 。

最佳回答

其实很简单

  • A non-authenticated user tries to access a protected resource in your app
  • A security filter intercepts the request
  • The filter stores the URL of the accessed protected resource in a session attribute
  • The filter forwards to the login screen
  • Once the login is successful, the URL is retrieved from the session, and the user is redirected to this URL

我只能这样做,那就是使用 GET 请求访问受保护的资源。 另一个变式是将受保护资源的 URL 存储在登录格式的隐藏字段中 。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签