Ignore:
Timestamp:
01/05/22 15:57:29 (2 years ago)
Author:
NikolaCenevski <cenevskinikola@…>
Branches:
master
Children:
6fa3d09
Parents:
881a233
Message:

part 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/charitable/controller/HomeController.java

    r881a233 rb8dc761  
    129129    @ModelAttribute("user")
    130130    public AppUser addAttributes() {
    131         if(SecurityContextHolder.getContext().getAuthentication().getPrincipal() != "anonymousUser") {
    132             return (AppUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
     131        if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() != "anonymousUser") {
     132            String email = SecurityContextHolder.getContext().getAuthentication().getName();
     133            System.out.println(email);
     134            return userService.loadUserByUsername(email);
    133135        }
    134136        return null;
Note: See TracChangeset for help on using the changeset viewer.