Reload MainLayout

Hi the community and happy new year.
In my application, I’ve used Spring security to implement the login feature.
In the class “MainLayout” I would like to define the menu item depending the user logged.
First I store the information of the user logged in session attribute in the class “ConfigureUIServiceInitListener”

	private void authenticateNavigation(BeforeEnterEvent event) {
		if (!LoginView.class.equals(event.getNavigationTarget()) && !SecurityUtils.isUserLoggedIn()) {
			event.rerouteTo(LoginView.class);
		}else
		{
			//si on est connecté et que l'on se dirige vers la page d'accueil
			if (SecurityUtils.isUserLoggedIn() & ParcourCompView.class.equals(event.getNavigationTarget() ))
			{
				//l'utilisateur est loggé
				UserT userConnected;
				userConnected = usertRepo.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
										
				//chargement données utilisateur loggé
				UI.getCurrent().getSession().setAttribute("userLogged", userConnected);
				UI.getCurrent().getSession().setAttribute("RolesUserLogged", userroleServ.getRoles(userConnected.getIdUser()));

I have no problem to do that, and it work fine.
Then I would like to use this attribute in my MainLayout to display menu depending the user.
But the class is loaded before the methode “authentificateNavigation” and of course those session attribute are null.

If you have already adapt your menu in relation of the user logged, can you explain me your method please ?

Thank you

OK I’ve solved my problem, I’ve followed the secured process implement in “Bakery Demo” and It works fine.