Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top