From 70642f4f9d0e69e92635c4a93b8286a5d830ccfb Mon Sep 17 00:00:00 2001 From: zlt2000 Date: Tue, 31 Aug 2021 22:20:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../central/oauth2/common/util/AuthUtils.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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;