File tree Expand file tree Collapse file tree 1 file changed +1
-3
lines changed
src/main/java/eu/openanalytics/containerproxy/service Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change 41
41
import org .springframework .security .core .GrantedAuthority ;
42
42
import org .springframework .security .core .context .SecurityContext ;
43
43
import org .springframework .security .core .context .SecurityContextHolder ;
44
- import org .springframework .security .core .userdetails .User ;
45
44
import org .springframework .security .web .session .HttpSessionCreatedEvent ;
46
45
import org .springframework .security .web .session .HttpSessionDestroyedEvent ;
47
46
import org .springframework .stereotype .Service ;
@@ -230,8 +229,7 @@ public void onHttpSessionDestroyedEvent(HttpSessionDestroyedEvent event) {
230
229
SecurityContext securityContext = event .getSecurityContexts ().get (0 );
231
230
if (securityContext == null ) return ;
232
231
233
- Authentication authentication = securityContext .getAuthentication ();
234
- String userId = ((User ) authentication .getPrincipal ()).getUsername ();
232
+ String userId = securityContext .getAuthentication ().getName ();
235
233
236
234
log .info (String .format ("User logged out [user: %s]" , userId ));
237
235
applicationEventPublisher .publishEvent (new UserLogoutEvent (
You can’t perform that action at this time.
0 commit comments