| | |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | |
| | | @Aspect |
| | | public class AdminLoginAspect { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(AdminLoginAspect.class); |
| | | |
| | | @Resource |
| | | private AdminUserService adminUserService; |
| | | |
| | |
| | | |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | |
| | | if(Constant.IS_TEST){ |
| | | admin=new AdminUser(); |
| | | if (Constant.IS_TEST) { |
| | | admin = new AdminUser(); |
| | | admin.setId(1L); |
| | | admin.setName("Ceshi"); |
| | | admin.setAccount("ceshi"); |
| | |
| | | signAES = URLDecoder.decode(request.getParameter("sign"), "UTF-8"); |
| | | String sign = AESUtil.decrypt(signAES, Constant.ADMINH5_AESKEY); |
| | | if (!StringUtil.isNullOrEmpty(sign)) { |
| | | LogHelper.error("H5审核签名:" + sign); |
| | | logger.debug("H5审核签名:" + sign); |
| | | JSONObject json = JSONObject.fromObject(sign); |
| | | long time = json.optLong("timeStamp"); |
| | | long adminId = json.optLong("adminId"); |
| | | AdminUser adminUser = adminUserService.selectByPrimaryKey(adminId); |
| | | // 1个小时链接失效 |
| | | if (System.currentTimeMillis() - time > 1000 * 60 * 60 || adminUser == null) { |
| | | logger.debug("H5审核链接失效"); |
| | | servletContainer.getResponse().getWriter() |
| | | .print(callback + "(" + JsonUtil.loadFalseResult(2, "链接失效") + ")"); |
| | | return null; |
| | | } else { |
| | | logger.debug("H5审核设置Session开始"); |
| | | request.getSession().setAttribute(Constant.SESSION_ADMIN, adminUser); |
| | | request.getSession().setAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT, "1"); |
| | | logger.debug("H5审核设置Session结束"); |
| | | } |
| | | } else { |
| | | servletContainer.getResponse().getWriter() |