Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

GTNPORTAL-3559 [Logout]Sometime show Unknow error when a user logout #914

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;

@ComponentConfig(template = "system:/groovy/portal/webui/application/UIStandaloneAppContainer.gtmpl", events = { @EventConfig(listeners = UIStandaloneAppContainer.LogoutActionListener.class) })
public class UIStandaloneAppContainer extends UIContainer {
Expand Down Expand Up @@ -124,20 +126,33 @@ public void processRender(WebuiRequestContext context) throws Exception {
}

public static class LogoutActionListener extends EventListener<UIComponent> {
private static final Logger log = LoggerFactory.getLogger(LogoutActionListener.class);
public void execute(Event<UIComponent> event) throws Exception {
StandaloneAppRequestContext context = (StandaloneAppRequestContext) event.getRequestContext();
HttpServletRequest req = context.getRequest();

// Delete the token from JCR
String token = getTokenCookie(req);
if (token != null) {
AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
try {
AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
} catch (Exception ex) {
if(log.isDebugEnabled()) {
log.debug("Exception when try to remove cookieToken", ex);
}
}
}
token = LoginServlet.getOauthRememberMeTokenCookie(req);
if (token != null) {
AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
try {
AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
} catch (Exception ex) {
if(log.isDebugEnabled()) {
log.debug("Exception when try to remove oauthCookieToken", ex);
}
}
}

LogoutControl.wantLogout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.web.security.impersonation.ImpersonatedIdentity;
import org.gatein.web.security.impersonation.ImpersonationUtils;

Expand Down Expand Up @@ -330,6 +332,7 @@ public void setDescription(String description) {
}

public static class LogoutActionListener extends EventListener<UIComponent> {
private static final Logger log = LoggerFactory.getLogger(LogoutActionListener.class);
public void execute(Event<UIComponent> event) throws Exception {
PortalRequestContext prContext = Util.getPortalRequestContext();
HttpServletRequest req = prContext.getRequest();
Expand All @@ -347,13 +350,25 @@ public void execute(Event<UIComponent> event) throws Exception {
// Delete the token from JCR
String token = getTokenCookie(req);
if (token != null) {
AbstractTokenService<GateInToken, String> tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
try {
AbstractTokenService<GateInToken, String> tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
} catch (Exception ex) {
if(log.isDebugEnabled()) {
log.debug("Exception when try to remove cookieToken", ex);
}
}
}
token = LoginServlet.getOauthRememberMeTokenCookie(req);
if(token != null) {
AbstractTokenService<GateInToken, String> tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
try {
AbstractTokenService<GateInToken, String> tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
} catch (Exception ex) {
if(log.isDebugEnabled()) {
log.debug("Exception when try to remove oauthCookieToken", ex);
}
}
}

LogoutControl.wantLogout();
Expand Down