if (auth instanceof JaasAuthenticationToken) {
if ((auth != null) && (auth instanceof JaasAuthenticationToken)) {
    protected void handleLogout(HttpSessionDestroyedEvent event) {        SecurityContext context = (SecurityContext) event.getSession().getAttribute(HttpSessionContextIntegrationFilter.ACEGI_SECURITY_CONTEXT_KEY);        Authentication auth = context.getAuthentication();        if (auth instanceof JaasAuthenticationToken) {            JaasAuthenticationToken token = (JaasAuthenticationToken) auth;            try {                LoginContext loginContext = token.getLoginContext();                if (loginContext != null) {                    log.debug("Logging principal: [" + token.getPrincipal() + "] out of LoginContext");                    loginContext.logout();                } else {                    log.debug("Cannot logout principal: [" + token.getPrincipal() + "] from LoginContext. " +                            "The LoginContext is unavailable");                }            } catch (LoginException e) {                log.warn("Error error logging out of LoginContext", e);            }        }    }