security - 将 Spring Security 3 与 GWT 2.1 REST/JSON 应用程序集成

标签 security json spring rest gwt

我需要在我的应用程序中使用 Spring Security 3,它由用于服务器端的 Spring 3 和用于客户端的 GWT 2.1 组成。

客户端和服务器端完全解耦,我的意思是它们不属于 Eclipse 工作区中的同一个项目(服务器端由 Maven 管理,客户端使用预构建的 ant 文件),到目前为止,它们彼此“通信”其他使用 Rest/Json。

谷歌搜索我发现了一些关于与 Spring Security 集成的教程和技巧,但它们都假设“客户端”知道 spring-服务器端类,因此在 gwt.server 包下使用 @Controller @Autowired 等。就我而言,这是不可能的(或者做起来不干净)。

有没有办法使用 Spring Security 并保持代码“解耦”?也许对于每个(其余)客户端请求,我应该使用“基本身份验证”?

谢谢, 兰德

最佳答案

以下是我在实现 GWT/Spring Security 时发现和使用的一些链接:

http://blahti.wordpress.com/2010/02/04/basics-of-gwt-authentication/

http://www.javacodegeeks.com/2010/12/securing-gwt-apps-with-spring-security.html

总之,只需将 GWT 视为要提供服务的静态 html 页面,而其余调用只是对静态页面的请求。仅当您想要客户端中来自 spring security 的特定信息(例如用户名)时,您才需要向服务器端添加一些内容,但在您的情况下,这也可以通过休息调用来完成。

关于security - 将 Spring Security 3 与 GWT 2.1 REST/JSON 应用程序集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4613914/

相关文章:

sql-server - 为什么非对称 key 更安全?

security - 文件 URI 链接到 IE7 中的本地文件夹不起作用

security - 编写安全的 ASP.NET 应用程序

spring - 对 Tomcat 的 Spring IoC 容器感到困惑

Spring Integration DSL : How to add the HTTP. outboundGateway header ?

php - 对 cookie 进行编码,使其不会被欺骗或读取等

python - gmail python api身份验证

ios - JSONObjectWithData 解析时错误的小数位

c# - 将 .NET 外部 dll 合并到单个可执行文件

java - Spring-Batch:为未知数量的分区编写分区器