|
|
@ -263,6 +263,11 @@ public class DefaultSystemSecurityService implements SystemSecurityService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void logLoginAction(User user, Object authenticationDetails, ActionType actionType, Exception e) { |
|
|
public void logLoginAction(User user, Object authenticationDetails, ActionType actionType, Exception e) { |
|
|
|
|
|
logLoginAction(user, authenticationDetails, actionType, null, e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void logLoginAction(User user, Object authenticationDetails, ActionType actionType, String provider, Exception e) { |
|
|
String clientAddress = "Unknown"; |
|
|
String clientAddress = "Unknown"; |
|
|
String browser = "Unknown"; |
|
|
String browser = "Unknown"; |
|
|
String os = "Unknown"; |
|
|
String os = "Unknown"; |
|
|
@ -278,38 +283,38 @@ public class DefaultSystemSecurityService implements SystemSecurityService { |
|
|
browser += " " + userAgent.userAgent.major; |
|
|
browser += " " + userAgent.userAgent.major; |
|
|
if (userAgent.userAgent.minor != null) { |
|
|
if (userAgent.userAgent.minor != null) { |
|
|
browser += "." + userAgent.userAgent.minor; |
|
|
browser += "." + userAgent.userAgent.minor; |
|
|
if (userAgent.userAgent.patch != null) { |
|
|
if (userAgent.userAgent.patch != null) { |
|
|
browser += "." + userAgent.userAgent.patch; |
|
|
browser += "." + userAgent.userAgent.patch; |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (userAgent.os != null) { |
|
|
} |
|
|
os = userAgent.os.family; |
|
|
if (userAgent.os != null) { |
|
|
if (userAgent.os.major != null) { |
|
|
os = userAgent.os.family; |
|
|
os += " " + userAgent.os.major; |
|
|
if (userAgent.os.major != null) { |
|
|
if (userAgent.os.minor != null) { |
|
|
os += " " + userAgent.os.major; |
|
|
os += "." + userAgent.os.minor; |
|
|
if (userAgent.os.minor != null) { |
|
|
if (userAgent.os.patch != null) { |
|
|
os += "." + userAgent.os.minor; |
|
|
os += "." + userAgent.os.patch; |
|
|
if (userAgent.os.patch != null) { |
|
|
if (userAgent.os.patchMinor != null) { |
|
|
os += "." + userAgent.os.patch; |
|
|
os += "." + userAgent.os.patchMinor; |
|
|
if (userAgent.os.patchMinor != null) { |
|
|
} |
|
|
os += "." + userAgent.os.patchMinor; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (userAgent.device != null) { |
|
|
} |
|
|
device = userAgent.device.family; |
|
|
if (userAgent.device != null) { |
|
|
} |
|
|
device = userAgent.device.family; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
if (actionType == ActionType.LOGIN && e == null) { |
|
|
if (actionType == ActionType.LOGIN && e == null) { |
|
|
userService.setLastLoginTs(user.getTenantId(), user.getId()); |
|
|
userService.setLastLoginTs(user.getTenantId(), user.getId()); |
|
|
} |
|
|
} |
|
|
auditLogService.logEntityAction( |
|
|
auditLogService.logEntityAction( |
|
|
user.getTenantId(), user.getCustomerId(), user.getId(), |
|
|
user.getTenantId(), user.getCustomerId(), user.getId(), |
|
|
user.getName(), user.getId(), null, actionType, e, clientAddress, browser, os, device); |
|
|
user.getName(), user.getId(), null, actionType, e, clientAddress, browser, os, device, provider); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static boolean isPositiveInteger(Integer val) { |
|
|
private static boolean isPositiveInteger(Integer val) { |
|
|
|