From 89238b527386e0a42d3c71b094478f9da1cd17e7 Mon Sep 17 00:00:00 2001 From: maximthomas Date: Fri, 19 Jan 2024 18:21:02 +0300 Subject: [PATCH] Avoid unnecessary CTS call if there's no session in LoginState --- .../authentication/service/LoginState.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openam-core/src/main/java/com/sun/identity/authentication/service/LoginState.java b/openam-core/src/main/java/com/sun/identity/authentication/service/LoginState.java index 27d8115529..8c13ab3e3c 100644 --- a/openam-core/src/main/java/com/sun/identity/authentication/service/LoginState.java +++ b/openam-core/src/main/java/com/sun/identity/authentication/service/LoginState.java @@ -1608,8 +1608,10 @@ public void setLocale(String locale) { /* destroy session */ void destroySession() { if (sessionReference != null) { - AuthUtils.removeAuthContext(finalSessionId); - LazyConfig.AUTHD.destroySession(finalSessionId); + if(!isNoSession()) { + AuthUtils.removeAuthContext(finalSessionId); + LazyConfig.AUTHD.destroySession(finalSessionId); + } finalSessionId = null; sessionReference = null; } @@ -4232,7 +4234,7 @@ void logSuccess() { String[] data = dataList.toArray(new String[dataList.size()]); String contextId = null; SSOToken localSSOToken = null; - if (!isNoSession()) { + if (!isNoSession() && oldSessionReference != null) { localSSOToken = getSSOToken(); } if (localSSOToken != null) { @@ -4252,7 +4254,11 @@ void logSuccess() { if (authMethName != null) { props.put(LogConstants.MODULE_NAME, authMethName); } - InternalSession session = getReferencedSession(); + InternalSession session = null; + if(!isNoSession()) { + session = getReferencedSession(); + } + if (session != null) { props.put(LogConstants.LOGIN_ID_SID, finalSessionId.toString()); }