优化判断逻辑

This commit is contained in:
zlt2000
2021-08-31 22:20:25 +08:00
parent 03b5db2651
commit 70642f4f9d
@@ -113,13 +113,15 @@ public class AuthUtils {
public static String getAccountType(Authentication authentication) {
Object details = authentication.getDetails();
String accountType = null;
if (details instanceof CustomWebAuthenticationDetails) {
CustomWebAuthenticationDetails detailsObj = (CustomWebAuthenticationDetails) details;
accountType = detailsObj.getAccountType();
} else {
Map<String, String> detailsMap = (Map<String, String>) details;
if (detailsMap != null) {
accountType = detailsMap.get(SecurityConstants.ACCOUNT_TYPE_PARAM_NAME);
if (details != null) {
if (details instanceof CustomWebAuthenticationDetails) {
CustomWebAuthenticationDetails detailsObj = (CustomWebAuthenticationDetails) details;
accountType = detailsObj.getAccountType();
} else {
Map<String, String> detailsMap = (Map<String, String>) details;
if (detailsMap != null) {
accountType = detailsMap.get(SecurityConstants.ACCOUNT_TYPE_PARAM_NAME);
}
}
}
return accountType;