java 重客户端使用 OpenAM 保护的 servlet 进行身份验证的正确方法是什么? [英] What is the correct way for a java heavy client to authenticate with an OpenAM protected servlet?
问题描述
java 重客户端使用 OpenAM
保护的 servlet 进行身份验证的正确方法是什么?
What is the correct way for a java heavy client to authenticate with an OpenAM
protected servlet?
Java openAM sdk
存在,我使用过它,它确实提供了对 SSO 令牌的访问.当这个相同的重型 Java
客户端尝试使用这个 SSO Token id
作为 cookie 将序列化对象发送到受保护的 tomcat 7 (tomee+) servlet 时,事情就会崩溃代码>.
OpenAM
过滤器使用包含凭据的嵌入/隐藏表单重定向.这会破坏序列化对象的通信.
Java openAM sdk
exists, which I have used and it does provide access to the SSO Token. Where things break down is when this same heavy Java
client attempts to send serialized objects to a protected tomcat 7 (tomee+) servlet using this SSO Token id
as a cookie
. The OpenAM
filter uses redirection with an embedded / hidden form containing credentials. This breaks the serialized object communications.
那么让 Java 重度客户端进行身份验证以便它可以将序列化对象来回发送到受保护的 servlet 的正确方法是什么?这甚至可能吗?
So what is the right way to have a Java heavy client authenticate such that it can then send serialized objects back and forth to a protected servlet? Is this even possible?
推荐答案
有几种方法可以验证客户端:
There are several ways to authenticate a client:
- 使用 REST API 对客户端进行身份验证(/identity/authenticate 或/json/authenticate)
- 使用 ClientSDK AuthContext API
- 向/UI/Login 发送 POST 请求(不一定是最好的方式..)
获取令牌后,您唯一需要确保的是将会话 cookie 发送到受保护的页面.如果您收到 JAAS 的自提交表单,则意味着您正在以 J2EE_POLICY 或 ALL 模式使用代理,并且启用了 Java EE 声明性安全性.此问题区域的可能解决方案:
After acquiring the token the only thing you have to make sure of is that you send the session cookie to the protected pages. In case you receive a self-submitting form for JAAS, then that means that you are using the agent in J2EE_POLICY or ALL mode and Java EE declarative security is enabled. Possible solutions for this problem area:
- 修改客户端,使其处理 JAAS FORM 登录内容(即获取输入值并手动执行 POST),之后您可能还必须将 JSESSIONID 与所有请求一起发送.
- 考虑在 web.xml 中删除对 servlet 的保护,这样容器就不会尝试显示 JAAS 登录表单,但这也意味着您也不会有花哨的 JAAS 集成(isUserInRole/getRemoteUser/@RolesAllowed/etc)
- 将您的 servlet 移动到一个单独的应用程序中,该应用程序可以在不同的代理过滤器模式 (URL_POLICY/SSO_ONLY) 中受到保护,它仍然会受到保护,但同样没有 JAAS 集成..
基本上,我想不出一种简单的方法来利用 JAAS 集成并使用重型客户端而不处理基于表单的登录.有一次我能够实现一个 Java EE 应用程序客户端,该客户端通过身份验证进入容器(代理)领域使用程序化登录并且有效,但我认为您的重度客户端实际上不是 Java EE 应用程序客户端..
Basically I can't think of an easy way of leveraging JAAS integration with the use of a heavy client without dealing with form based login.. At one point in time I was able to implement a Java EE application client that authenticated into the container's (agent's) realm using programmatic login and that worked, but I don't suppose your heavy client is actually a Java EE application client..
这篇关于java 重客户端使用 OpenAM 保护的 servlet 进行身份验证的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!