| | |
| | | package com.stylefeng.guns.modular.system.controller.system; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.code.kaptcha.Constants; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.IMenuService; |
| | | import com.stylefeng.guns.modular.system.service.ITEnterpriseWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.stylefeng.guns.core.support.HttpKit.getIp; |
| | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IShiro shiro; |
| | |
| | | |
| | | private Map<String, Integer> loginFailures = new HashMap<>(); |
| | | |
| | | @Resource |
| | | private ITEnterpriseWithdrawalService enterpriseWithdrawalService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到主页 |
| | |
| | | @RequestMapping(value = "/", method = RequestMethod.GET) |
| | | public String index(Model model, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | //session中解析用户数据 |
| | | //设置共享session |
| | | HttpSession session = (HttpSession) redisTemplate.opsForValue().get(request.getSession().getId()); |
| | | if (null != session) { |
| | | session = request.getSession(); |
| | | redisTemplate.opsForValue().set(request.getSession().getId(), session, 2, TimeUnit.DAYS); |
| | | } |
| | | HttpSession session = request.getSession(); |
| | | String onconParam = edu.yale.its.tp.cas.client.Util.getOnconParam(session); |
| | | onconParam = new String(Base64.decodeBase64(onconParam), "UTF-8"); |
| | | LoginUser loginUser = JSON.parseObject(onconParam, LoginUser.class); |
| | |
| | | //获取菜单列表 |
| | | User user = userMapper.getByAccount(loginUser.getImUser()); |
| | | if (null == user) { |
| | | logOut(); |
| | | logOut(request); |
| | | return null; |
| | | } |
| | | ShiroUser shiroUser = shiro.shiroUser(user); |
| | | List<Integer> roleList = shiroUser.getRoleList(); |
| | |
| | | * 退出登录 |
| | | */ |
| | | @RequestMapping(value = "/logout", method = RequestMethod.GET) |
| | | public String logOut() { |
| | | HttpUtil.get("https://testsso1.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3F%0Alogoutat%3Dhttp%253A%252F%252F127.0.0.1%253A8010%252F"); |
| | | public String logOut(HttpServletRequest request) { |
| | | request.getSession().invalidate(); |
| | | // HttpUtil.get("https://testsso1.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3Flogoutat%3Dhttps%3A%2F%2Ftraffic.qytzt.cn%2F"); |
| | | return REDIRECT + "/"; |
| | | } |
| | | |