Skip to content

Commit f193bbb

Browse files
nick9822adamsaghy
authored andcommitted
FINERACT-2391: check for AppUser type before casting Authentication Principal
1 parent b9e6f21 commit f193bbb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AuditorAwareImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Optional<Long> getCurrentAuditor() {
3535
final SecurityContext securityContext = SecurityContextHolder.getContext();
3636
if (securityContext != null) {
3737
final Authentication authentication = securityContext.getAuthentication();
38-
if (authentication != null) {
38+
if (authentication != null && authentication.getPrincipal() instanceof AppUser) {
3939
currentUserId = Optional.ofNullable(((AppUser) authentication.getPrincipal()).getId());
4040
} else {
4141
currentUserId = retrieveSuperUser();

0 commit comments

Comments
 (0)