package GameNationBackEnd.Filters;

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

public class RoutingFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {}

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest)request;
        String uri = req.getRequestURI();

        if (uri.startsWith("/api") || uri.endsWith(".html") || uri.endsWith(".css") || uri.endsWith(".jpg") || uri.endsWith(".png") || uri.endsWith(".ttf") || uri.endsWith(".js")) {
            chain.doFilter(request, response);
        } else {
            req.getRequestDispatcher("/index.html").forward(request, response);
        }
    }

    @Override
    public void destroy() {}
}

@@ -550,24 +550,52 @@
 h(%22/api%22) %7C%7C
+ uri.startsWith(%22/oauth%22) %7C%7C
  uri.endsWit

Allow oauth through filter