Source:
<code>public Event terminate(final RequestContext context) { String tgtId = WebUtils.getTicketGrantingTicketId(context); <START> String institutionId = "osf"; <END> Boolean remotePrincipal = Boolean.FALSE; if (tgtId == null) { final HttpServletRequest request = WebUtils.getHttpServletRequest(context); tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request); } if (tgtId != null) { TicketGrantingTicket tgt = null; try { tgt = centralAuthenticationService.getTicket(tgtId, TicketGrantingTicket.class); } catch (final Exception e) { } if (tgt != null) { final Authentication auth = tgt.getAuthentication(); if (auth != null) { institutionId = (String) auth.getAttributes().get("institutionId"); remotePrincipal = (Boolean) auth.getAttributes().get("remotePrincipal"); } } WebUtils.putLogoutRequests(context, this.centralAuthenticationService.destroyTicketGrantingTicket(tgtId)); } final HttpServletResponse response = WebUtils.getHttpServletResponse(context); this.ticketGrantingTicketCookieGenerator.removeCookie(response); this.warnCookieGenerator.removeCookie(response); final HttpServletRequest request = WebUtils.getHttpServletRequest(context); final Cookie[] cookies = request.getCookies(); if (cookies != null) { for (final Cookie cookie : cookies) { if (cookie.getName().startsWith( OpenScienceFrameworkPrincipalFromRequestRemoteUserNonInteractiveCredentialsAction.SHIBBOLETH_COOKIE_PREFIX)) { logger.info("Remove shibboleth session cookie: {}", cookie.getName()); final Cookie shibbolethCookie = new Cookie(cookie.getName(), null); shibbolethCookie.setMaxAge(0); response.addCookie(shibbolethCookie); } } } if (remotePrincipal) { final String institutionLogoutUrl = OpenScienceFrameworkLogoutHandler.findInstitutionLogoutUrlById(institutionId); if (institutionLogoutUrl == null) { logger.warn("Institution does not have logout url, use default logout redirection instead", institutionId); } else { context.getFlowScope().put("logoutRedirectUrl", institutionLogoutUrl); return new Event(this, "finish"); } } return this.eventFactorySupport.success(this); }</code><technical_language>need set a default</technical_language>

Target:
public Event terminate(final RequestContext context) { String tgtId = WebUtils.getTicketGrantingTicketId(context); String institutionId = null; Boolean remotePrincipal = Boolean.FALSE; if (tgtId == null) { final HttpServletRequest request = WebUtils.getHttpServletRequest(context); tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request); } if (tgtId != null) { TicketGrantingTicket tgt = null; try { tgt = centralAuthenticationService.getTicket(tgtId, TicketGrantingTicket.class); } catch (final Exception e) { } if (tgt != null) { final Authentication auth = tgt.getAuthentication(); if (auth != null) { if (auth.getAttributes().containsKey("institutionId")) { institutionId = (String) auth.getAttributes().get("institutionId"); } if (auth.getAttributes().containsKey("remotePrincipal")) { remotePrincipal = (Boolean) auth.getAttributes().get("remotePrincipal"); } } } WebUtils.putLogoutRequests(context, this.centralAuthenticationService.destroyTicketGrantingTicket(tgtId)); } final HttpServletResponse response = WebUtils.getHttpServletResponse(context); this.ticketGrantingTicketCookieGenerator.removeCookie(response); this.warnCookieGenerator.removeCookie(response); if (remotePrincipal && institutionId != null) { final String institutionLogoutUrl = this.logoutHandler.findInstitutionLogoutUrlById(institutionId); if (institutionLogoutUrl == null) { logger.warn("Institution does not have logout url, use default logout redirection instead", institutionId); } else { context.getFlowScope().put("logoutRedirectUrl", institutionLogoutUrl); return new Event(this, "finish"); } } return this.eventFactorySupport.success(this); }