FINERACT-2391: check for AppUser type before casting Authentication Principal
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ public class AuditorAwareImpl implements AuditorAware<Long> {
|
|||||||
final SecurityContext securityContext = SecurityContextHolder.getContext();
|
final SecurityContext securityContext = SecurityContextHolder.getContext();
|
||||||
if (securityContext != null) {
|
if (securityContext != null) {
|
||||||
final Authentication authentication = securityContext.getAuthentication();
|
final Authentication authentication = securityContext.getAuthentication();
|
||||||
if (authentication != null) {
|
if (authentication != null && authentication.getPrincipal() instanceof AppUser) {
|
||||||
currentUserId = Optional.ofNullable(((AppUser) authentication.getPrincipal()).getId());
|
currentUserId = Optional.ofNullable(((AppUser) authentication.getPrincipal()).getId());
|
||||||
} else {
|
} else {
|
||||||
currentUserId = retrieveSuperUser();
|
currentUserId = retrieveSuperUser();
|
||||||
|
|||||||
Reference in New Issue
Block a user