优化判断逻辑
This commit is contained in:
+9
-7
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user