load user menu in overview

This commit is contained in:
Katerina Iatropoulou 2020-11-05 08:33:17 +00:00
parent d854a452a2
commit a60b3fedd9
1 changed files with 1 additions and 1 deletions

View File

@ -16,12 +16,12 @@ public class OverviewServlet extends HttpServlet {
boolean isAuthenticated = !SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString()
.equals("anonymousUser");
System.out.println("Authenticated ? " + isAuthenticated);
if (isAuthenticated) {
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
StringBuilder name = new StringBuilder().append(authentication.getUserInfo().getGivenName().charAt(0));
name.append(authentication.getUserInfo().getFamilyName().charAt(0));
request.getSession().setAttribute("authenticated", isAuthenticated);
request.getSession().setAttribute("name", name.toString());
}