在類SendTicketGrantingTicketAction.java中修改的java
protected Event doExecute(final RequestContext context) { final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); final String ticketGrantingTicketValueFromCookie = (String) context.getFlowScope().get("ticketGrantingTicketId"); if (ticketGrantingTicketId == null) { return success(); } try { /* * 根據用戶和密碼存放ticket 後者登陸踢掉前者 */ String ticketIdkey = context.getRequestParameters().get("username")+"$"+context.getRequestParameters().get("password"); // String contextKey = ticketIdkey + "#"; if(LoginRememberMap.LoginCookieRemberTicket.get(ticketIdkey) != null){ // HttpSession httpSession = WebUtils.getHttpServletRequest(LoginRememberMap.LoginCookieRemberContent.get(contextKey)).getSession(); // httpSession.setAttribute("loginRepeat", "您的帳號已在別處登陸!"); this.centralAuthenticationService .destroyTicketGrantingTicket(LoginRememberMap.LoginCookieRemberTicket.get(ticketIdkey)); } // LoginRememberMap.LoginCookieRemberContent.put(contextKey, context); LoginRememberMap.LoginCookieRemberTicket.put(ticketIdkey, ticketGrantingTicketId); } catch (Exception e) { e.printStackTrace(); } this.ticketGrantingTicketCookieGenerator.addCookie(WebUtils.getHttpServletRequest(context), WebUtils .getHttpServletResponse(context), ticketGrantingTicketId); if (ticketGrantingTicketValueFromCookie != null && !ticketGrantingTicketId.equals(ticketGrantingTicketValueFromCookie)) { this.centralAuthenticationService .destroyTicketGrantingTicket(ticketGrantingTicketValueFromCookie); } return success(); }
記得註銷的時候還要移除相應的this
源碼看的不明不白的,提示信息一直傳不到頁面,code