This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new f193bbbdf1 FINERACT-2391: check for AppUser type before casting 
Authentication Principal
f193bbbdf1 is described below

commit f193bbbdf1432342db5a8276e44ee6a6bd3cf8db
Author: Nickesh <[email protected]>
AuthorDate: Thu Oct 9 18:43:37 2025 +0530

    FINERACT-2391: check for AppUser type before casting Authentication 
Principal
---
 .../apache/fineract/infrastructure/core/domain/AuditorAwareImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AuditorAwareImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AuditorAwareImpl.java
index 981dd8aa9d..fc93b7f6ce 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AuditorAwareImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AuditorAwareImpl.java
@@ -35,7 +35,7 @@ public class AuditorAwareImpl implements AuditorAware<Long> {
         final SecurityContext securityContext = 
SecurityContextHolder.getContext();
         if (securityContext != null) {
             final Authentication authentication = 
securityContext.getAuthentication();
-            if (authentication != null) {
+            if (authentication != null && authentication.getPrincipal() 
instanceof AppUser) {
                 currentUserId = Optional.ofNullable(((AppUser) 
authentication.getPrincipal()).getId());
             } else {
                 currentUserId = retrieveSuperUser();

Reply via email to