package org.jamesdbloom.web.controller;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
/**
* @author jamesdbloom
*/
@Controller
public class LoginPageController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String getPage(HttpServletRequest request, Model model) {
CsrfToken csrfToken = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
if (csrfToken != null) {
model.addAttribute("csrfParameterName", csrfToken.getParameterName());
model.addAttribute("csrfToken", csrfToken.getToken());
}
return "login";
}
}