Prelogin filter before j_security_check

前提是你 提交于 2019-12-31 04:54:26

问题


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.

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:

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.


回答1:


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.

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.

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.

Thanks
J



来源:https://stackoverflow.com/questions/8678584/prelogin-filter-before-j-security-check

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!