blob: a21eea66eeb38a8a00792aca5f75c7f1a80b1a7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package com.mavlushechka.studentdatabase.controller;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Map;
@Controller
public class HomeController {
@GetMapping("/")
public String getLoginButtonText(Authentication authentication, Map<String, Object> model) {
boolean authorized = authentication != null;
String loginButtonText = (authorized) ? authentication.getName() : "Kirish";
model.put("authorized", authorized);
model.put("loginButtonText", loginButtonText);
return "index";
}
}
|