diff --git a/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java b/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java index 4b717617..386bcbbc 100644 --- a/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java +++ b/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java @@ -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 detailsMap = (Map) 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 detailsMap = (Map) details; + if (detailsMap != null) { + accountType = detailsMap.get(SecurityConstants.ACCOUNT_TYPE_PARAM_NAME); + } } } return accountType;