<BUG>log.debug("Logout result is '{0}' for user '{1}'", externalLogoutResult, userId);
int apiVersion = externalAuthenticationService.executeExternalGetApiVersion(customScriptConfiguration);</BUG>
if (apiVersion < 3) {
return externalLogoutResult;
}
<BUG>if (sessionState == null) {
log.warn("Session was expired. Redirect to external URL is not possible.");
return ExternalLogoutResult.FAILURE;
}</BUG>
log.trace("According to API version script supports logout redirects");

CustomScriptConfiguration customScriptConfiguration = externalAuthenticationService.getCustomScriptConfigurationByName(acrValues);
if (customScriptConfiguration == null) {
log.error("Failed to get ExternalAuthenticatorConfiguration. acr_values: {0}", acrValues);
return ExternalLogoutResult.FAILURE;
} else {
boolean scriptExternalLogoutResult = externalAuthenticationService.executeExternalLogout(customScriptConfiguration, null);
ExternalLogoutResult externalLogoutResult = scriptExternalLogoutResult ? ExternalLogoutResult.SUCCESS : ExternalLogoutResult.FAILURE;
log.debug("Logout result is '{0}' for session '{1}', userDn: '{2}'", externalLogoutResult, sessionState.getId(), sessionState.getUserDn());
int apiVersion = externalAuthenticationService.executeExternalGetApiVersion(customScriptConfiguration);
if (apiVersion < 3) {
return externalLogoutResult;
}
log.trace("According to API version script supports logout redirects");
