title: doFilter JSF User Authentication
body: <p>I am trying to use a doFilter and my web.xml page to force users to login to access any "secured" page.</p>
  
  <p>I found an example <a href="http://www.itcuties.com/j2ee/jsf-2-login-filter-example/" rel="nofollow noreferrer">here</a> and I have implemented it. I am having a small issue though. When I put the filter definition into web.xml the entire website fails to load. I do believe this is because I do not have the proper class path to the java file which contains the filter.  I am showing you my web.xml page next to my project explorer. <img src="https://i.stack.imgur.com/et6wq.png" alt="Auth Filter"> I am hoping you can help me with the class path needed for the <code>&lt;filter-class&gt;     &lt;/filter-class&gt;</code></p>
  
  <p>I am also showing my <code>doFilter method</code></p>
  
  <pre><code>@Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
      UserBean userBean = (UserBean)((HttpServletRequest)request).getSession().getAttribute("userBean");
  
      if(userBean == null || !userBean.isSuccessfullLogin()){
          String contextPath = ((HttpServletRequest)request).getContextPath();
          ((HttpServletResponse)response).sendRedirect(contextPath + "/index.xhtml");
      }
      chain.doFilter(request, response);
  }
  </code></pre>
  
  <p>So far the rest of my server works, the website runs but I can not get the filter. Any suggestions are accepted! </p>
  
  <p>Thank you!</p>