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

查看:144
本文介绍了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登录之前,我该如何截获该请求,并在发现该条件为假之后将该流程转发给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是服务器首先发生的事情.因此,您将无法从Serverside拦截它.

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天全站免登陆