I am using MVC (custom tag) and i want to know how to restrict direct access to the application pages unless authenticated, I tried using a filter but am running into a problem that it blocks the access to the login page itself, i want every user to access login page and only after authentication he gets access to other pages. please tell me wat changes i need to make in my code ?
inside Myjsp folder i have all the .jsp pages (\Tomcat 6.0\webapps\Myjsp) and class files are inside classes/pack/java
Below is the filter:
package pack.java;
import java.io.*;
import javax.servlet.*;
public class loginfilter implements Filter {
String aa;
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
aa = request.getRequestURI();
chain.doFilter(request, response);
}
public void init(FilterConfig fconfig) throws ServletException {
}
}
Web.xml entry:
<filter>
<filter-name>loginfilter</filter-name>
<filter-class>pack.java</filter-class>
</filter>
<filter-mapping>
<filter-name>loginfilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>