Commit 19426ff32a2dea3dcea2d202348b6fff55f0bee3
1 parent
94a17877
Fix SecurityService, returning principal instead of details
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
src/main/java/fr/plil/sio/web/mvc/SecurityServiceImpl.java
... | ... | @@ -14,10 +14,11 @@ public class SecurityServiceImpl implements SecurityService{ |
14 | 14 | |
15 | 15 | @Override |
16 | 16 | public String findLoggedInUsername() { |
17 | - Object userDetails = SecurityContextHolder.getContext().getAuthentication().getDetails(); | |
17 | + Object userDetails = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | |
18 | 18 | if (userDetails instanceof UserDetails) { |
19 | 19 | return ((UserDetails)userDetails).getUsername(); |
20 | 20 | } |
21 | + logger.warn("cannot find logged user"); | |
21 | 22 | return null; |
22 | 23 | } |
23 | 24 | } |
24 | 25 | \ No newline at end of file | ... | ... |