@RequestMapping(value = "/login_fb")
  public void loginFaceBook(HttpServletRequest request, HttpServletResponse response)
      throws FacebookException, IOException, ServletException {
    String code = request.getParameter("code");
    OAuthAccessToken accessToken =
        Face4jFactory.getInstance()
            .getFacebookFactory()
            .getOAuthAccessToken(code, "http://spring-forest-538.appspot.com/login_fb");

    facebookLoginHandler.authenticate(accessToken, request, response);
    response.sendRedirect("/home");
  }
  @RequestMapping(value = "/login", method = RequestMethod.GET)
  public ModelAndView login(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    request.getSession().invalidate();
    SecurityContextHolder.getContext();

    String loginURL = UserServiceFactory.getUserService().createLoginURL("/home");

    FacebookFactory facebookFactory = Face4jFactory.getInstance().getFacebookFactory();

    ModelAndView modelAndView = new ModelAndView("login");
    modelAndView.addObject("googleUrl", loginURL);
    modelAndView.addObject(
        "facebookUrl",
        facebookFactory.getRedirectURL(
            "http://spring-forest-538.appspot.com/login_fb",
            Display.POPUP,
            Permission.EMAIL,
            Permission.OFFLINE_ACCESS));
    return modelAndView;
  }