chore: default to SYSTEM authentication
If authentication is not set on the security context, we can default to
`SYSTEM`. This is common when running migrations that alter the state of
audited objects.
@@ -148,6 +148,10 @@ public final class AuditingInterceptor {
final SecurityContext context = SecurityContextHolder.getContext();
final Authentication authentication = context.getAuthentication();
+ if (authentication == null) {
+ return "SYSTEM";
+ }
+
return authentication.getName();
}
}
