j_security_check 前的登录前过滤器 [英] Prelogin filter before j_security_check

查看:42
本文介绍了j_security_check 前的登录前过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的应用程序中有一个基于表单的登录,它是在 Jboss 门户服务器上开发的.我希望进行一些登录前验证,并在条件为真的情况下将用户重定向到另一个页面.

I currently have a form based login in my application which is developed on Jboss portal server. I wish to do some pre login validation and redirect user to another page in case of a condition being true.

如何在执行 j_security_check login 之前拦截请求,并在发现该条件为假后将流程转发到 j_security_check.

How can I intercept the request before j_security_check login is executed and also forward the flow to j_security_check after that condition is found to be false.

请注意,我不想进行客户端验证.

Please note that I do not want to have client side validation.

这就是我试图做的,但没有发现任何成功:

This is what I was trying to do, but didn't find any success:

创建了一个 LoginFilter.java 文件,我的 webapp web.xml 看起来像:

Created a LoginFilter.java file and my webapp web.xml looked like:

<filter>
  <filter-name>LoginFilter</filter-name>
  <filter-class>com.xxx.filter.LoginFilter</filter-class>
</filter>

<filter-mapping>
  <filter-name>LoginFilter</filter-name>
  <url-pattern>j_security_check</url-pattern>
</filter-mapping>

但是这个过滤器根本没有被调用.

but this filter is not being called at all.

谁能告诉我这段代码有什么问题或解决这个问题的任何替代方法.

Can anyone tell me what is the issue in this code or any alternative approach to solve this issue.

推荐答案

您将无法从 Serverside 拦截 j_security_check.如果您的资源是安全的,则仅在 j_security_check 通过后才会调用过滤器和所有.

You wont be able to intercept j_security_check from Serverside. Filters and all will be called only after j_security_check passed , if your resource is secured.

我遇到过类似的情况,我改变了应用程序进行调用的方式.首先发出一个 http 请求来做 j_security_check,然后使用相同的客户端实例来完成剩下的工作.

I had similar case , I changed the way my application was making calls. First make a http request to do j_security_check and then use same client instance to do rest of the work.

最重要的是,j_security_check 是服务器发生的第一件事.所以你将无法从服务器端拦截它.

The bottom line is that , j_security_check is the first thing happens are server. So you wont be able to intercept it from Serverside.

谢谢
J

这篇关于j_security_check 前的登录前过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆