| | |
| | | import com.whyc.util.RSAUtil; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.session.ExpiredSessionException; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | public Response checkUserWebSocket(HttpSession httpSession){ |
| | | Response model = new Response(); |
| | | UserInf user = (UserInf) httpSession.getAttribute("user"); |
| | | System.out.println("webSocket:"+user); |
| | | String sessionId = (String) httpSession.getServletContext().getAttribute(user.getUName()); |
| | | if(httpSession.getId().equals(sessionId)){ |
| | | model.set(1,user,null); |
| | | }else{ |
| | | model.set(1,false,"不同主机登录"); |
| | | try { |
| | | UserInf user = (UserInf) httpSession.getAttribute("user"); |
| | | System.out.println("webSocket:"+user); |
| | | String sessionId = (String) httpSession.getServletContext().getAttribute(user.getUName()); |
| | | if(httpSession.getId().equals(sessionId)){ |
| | | model.set(1,user,null); |
| | | }else{ |
| | | model.set(1,false,"不同主机登录"); |
| | | } |
| | | }catch (ExpiredSessionException e){ |
| | | model.set(1,false,"session过期!"); |
| | | } |
| | | |
| | | return model; |
| | | } |
| | | |