优化判断逻辑
This commit is contained in:
+9
-7
@@ -113,13 +113,15 @@ public class AuthUtils {
|
|||||||
public static String getAccountType(Authentication authentication) {
|
public static String getAccountType(Authentication authentication) {
|
||||||
Object details = authentication.getDetails();
|
Object details = authentication.getDetails();
|
||||||
String accountType = null;
|
String accountType = null;
|
||||||
if (details instanceof CustomWebAuthenticationDetails) {
|
if (details != null) {
|
||||||
CustomWebAuthenticationDetails detailsObj = (CustomWebAuthenticationDetails) details;
|
if (details instanceof CustomWebAuthenticationDetails) {
|
||||||
accountType = detailsObj.getAccountType();
|
CustomWebAuthenticationDetails detailsObj = (CustomWebAuthenticationDetails) details;
|
||||||
} else {
|
accountType = detailsObj.getAccountType();
|
||||||
Map<String, String> detailsMap = (Map<String, String>) details;
|
} else {
|
||||||
if (detailsMap != null) {
|
Map<String, String> detailsMap = (Map<String, String>) details;
|
||||||
accountType = detailsMap.get(SecurityConstants.ACCOUNT_TYPE_PARAM_NAME);
|
if (detailsMap != null) {
|
||||||
|
accountType = detailsMap.get(SecurityConstants.ACCOUNT_TYPE_PARAM_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return accountType;
|
return accountType;
|
||||||
|
|||||||
Reference in New Issue
Block a user