diff --git a/maxkey-core/src/main/java/org/maxkey/domain/Organizations.java b/maxkey-core/src/main/java/org/maxkey/domain/Organizations.java index bf309d9a4..2354023a7 100644 --- a/maxkey-core/src/main/java/org/maxkey/domain/Organizations.java +++ b/maxkey-core/src/main/java/org/maxkey/domain/Organizations.java @@ -85,9 +85,13 @@ public class Organizations extends JpaBaseDomain implements Serializable { private String description; private String status; + @Column + private String extId; + @Column + private String extParentId; public Organizations() { - // TODO Auto-generated constructor stub + // } public String getId() { @@ -309,8 +313,24 @@ public class Organizations extends JpaBaseDomain implements Serializable { public void setStatus(String status) { this.status = status; } + + public String getExtId() { + return extId; + } - @Override + public void setExtId(String extId) { + this.extId = extId; + } + + public String getExtParentId() { + return extParentId; + } + + public void setExtParentId(String extParentId) { + this.extParentId = extParentId; + } + + @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Organizations [id="); @@ -365,6 +385,10 @@ public class Organizations extends JpaBaseDomain implements Serializable { builder.append(description); builder.append(", status="); builder.append(status); + builder.append(", extId="); + builder.append(extId); + builder.append(", extParentId="); + builder.append(extParentId); builder.append("]"); return builder.toString(); } diff --git a/maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LogoutEndpoint.java b/maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LogoutEndpoint.java index 6b12e4d1a..68c315093 100644 --- a/maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LogoutEndpoint.java +++ b/maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LogoutEndpoint.java @@ -112,32 +112,38 @@ public class LogoutEndpoint { _logger.debug("re Login URL : "+ reLoginUrl); modelAndView.addObject("reloginUrl",reLoginUrl); - String onlineTicketId = ((SigninPrincipal)WebContext.getAuthentication().getPrincipal()).getOnlineTicket().getTicketId(); - OnlineTicket onlineTicket = onlineTicketServices.get(onlineTicketId); - - Set> entrySet = onlineTicket.getAuthorizedApps().entrySet(); - - Iterator> iterator = entrySet.iterator(); - while (iterator.hasNext()) { - Entry mapEntry = iterator.next(); - _logger.debug("App Id : "+ mapEntry.getKey()+ " , " +mapEntry.getValue()); - if( mapEntry.getValue().getLogoutType() == LogoutType.BACK_CHANNEL){ - SingleLogout singleLogout; - if(mapEntry.getValue().getProtocol().equalsIgnoreCase(ConstantsProtocols.CAS)) { - singleLogout =new SamlSingleLogout(); - }else { - singleLogout = new DefaultSingleLogout(); - } - singleLogout.sendRequest(onlineTicket.getAuthentication(), mapEntry.getValue()); - } - } - onlineTicketServices.remove(onlineTicketId); + //if logined in have onlineTicket ,need remove or logout back + if(WebContext.getAuthentication() != null) { + String onlineTicketId = ((SigninPrincipal)WebContext.getAuthentication().getPrincipal()).getOnlineTicket().getTicketId(); + OnlineTicket onlineTicket = onlineTicketServices.get(onlineTicketId); + if(onlineTicket != null) { + Set> entrySet = onlineTicket.getAuthorizedApps().entrySet(); + + Iterator> iterator = entrySet.iterator(); + while (iterator.hasNext()) { + Entry mapEntry = iterator.next(); + _logger.debug("App Id : "+ mapEntry.getKey()+ " , " +mapEntry.getValue()); + if( mapEntry.getValue().getLogoutType() == LogoutType.BACK_CHANNEL){ + SingleLogout singleLogout; + if(mapEntry.getValue().getProtocol().equalsIgnoreCase(ConstantsProtocols.CAS)) { + singleLogout =new SamlSingleLogout(); + }else { + singleLogout = new DefaultSingleLogout(); + } + singleLogout.sendRequest(onlineTicket.getAuthentication(), mapEntry.getValue()); + } + } + onlineTicketServices.remove(onlineTicketId); + } + } //remove ONLINE_TICKET cookie - WebContext.expiryCookie(WebContext.getResponse(), - this.applicationConfig.getBaseDomainName(), - WebConstants.ONLINE_TICKET_NAME, - UUID.randomUUID().toString()); + WebContext.expiryCookie( + WebContext.getResponse(), + this.applicationConfig.getBaseDomainName(), + WebConstants.ONLINE_TICKET_NAME, + UUID.randomUUID().toString() + ); request.getSession().invalidate(); SecurityContextHolder.clearContext();