/**
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
 */
package com.codeup.auth.filters;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class AuthenticationFilter implements Filter {
    private String redirectTo;

    public void doFilter(
        ServletRequest req,
        ServletResponse resp,
        FilterChain chain
    ) throws ServletException, IOException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpSession session = request.getSession(false);

        if (session == null || session.getAttribute("user") == null) {
            ((HttpServletResponse) resp).sendRedirect(redirectTo);
        } else {
            chain.doFilter(req, resp);
        }
    }

    public void destroy() {
    }

    public void init(FilterConfig config) throws ServletException {
        redirectTo = config.getInitParameter("redirectTo");
    }
}

@@ -459,16 +459,20 @@
 uest req
+uest
 ,%0A      
@@ -493,16 +493,20 @@
 nse resp
+onse
 ,%0A      
@@ -588,31 +588,25 @@
 tpSe
-rvletRequest request
+ssion session
  = 
+(
 (Htt
@@ -625,51 +625,16 @@
 est)
- req;%0A        HttpSession session =
  request
 .get
@@ -629,16 +629,17 @@
  request
+)
 .getSess
@@ -761,16 +761,20 @@
 se) resp
+onse
 ).sendRe
@@ -844,14 +844,22 @@
 (req
+uest
 , resp
+onse
 );%0A 

Fix naming in authentication filter.