我的 JBOSS 4 中安装了 CAS 3.5.2 和欢迎 Web 应用程序。
我通过实现接口(interface)编写了一个自定义 AuthenticationHandler:
org.jasig.cas.authentication.handler.AuthenticationHandler。
我的 AuthenticationHandler 身份验证正确,但如果身份验证正确,我想使用 response.addCookie 方法生成 cookie。所以我需要访问 HttpServletResponse。问题是我在身份验证方法中收到的唯一信息是 [Credentials credential] 参数。
我该怎么做?
最佳答案
事实上,身份验证处理程序仅提供凭据作为输入参数。不过,您可以使用 ExternalContextHolder
对象(来自 SpringWebflow)来获取 ServletExternalContext
,从中您可以获得 HttpServletRequest
...
关于cookies - 如何从自定义 CAS AuthenticationHandler 访问 HttpServletResponse 以生成 cookie?在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21434885/