package es.uv.saic.web;

import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

	/*
	 * Redirect root to /procedures if authenticated, to /login otherwise
	 * @param model
	 * @param auth Authentication
	 * @return "procedures" if authenticated, "redirect: login" otherwise
	 */
	@RequestMapping("/")
	public String getHome(Model model, Authentication auth) {
		if(auth != null) {
			return "procedures";
		}
		else {
			return "redirect: login";
		}
		
	}
	
}
