| | |
| | | import me.zhyd.oauth.model.AuthResponse; |
| | | import me.zhyd.oauth.request.AuthRequest; |
| | | import me.zhyd.oauth.utils.AuthStateUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.util.JwtUtil; |
| | |
| | | import org.jeecg.common.util.RedisUtil; |
| | | import org.jeecg.common.util.RestUtil; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.config.shiro.JwtToken; |
| | | import org.jeecg.config.thirdapp.ThirdAppConfig; |
| | | import org.jeecg.config.thirdapp.ThirdAppTypeItemVo; |
| | | import org.jeecg.modules.base.service.BaseCommonService; |
| | |
| | | String token = JwtUtil.sign(user.getUsername(), user.getPassword()); |
| | | redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token); |
| | | // 设置超时时间 |
| | | redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, EXPIRE_TIME / 1000); |
| | | redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000); |
| | | return token; |
| | | } |
| | | |
| | |
| | | builder.append("&response_type=code"); |
| | | // 应用授权作用域。 |
| | | // snsapi_base:静默授权,可获取成员的的基础信息(UserId与DeviceId); |
| | | builder.append("&scope=snsapi_base"); |
| | | // builder.append("&scope=snsapi_base"); |
| | | builder.append("&scope=snsapi_privateinfo"); // 手动授权作用域 |
| | | // 重定向后会带上state参数,长度不可超过128个字节 |
| | | builder.append("&state=").append(state); |
| | | builder.append("&agentid=").append(config.getAgentId()); // 补充AgentID |
| | | // 终端使用此参数判断是否需要带上身份信息 |
| | | builder.append("#wechat_redirect"); |
| | | url = builder.toString(); |
| | |
| | | } |
| | | |
| | | String token = saveToken(loginUser); |
| | | state += "/oauth2-app/login?oauth2LoginToken=" + URLEncoder.encode(token, "UTF-8"); |
| | | state += "/h5/oauth2-app/login?oauth2LoginToken=" + URLEncoder.encode(token, "UTF-8"); |
| | | //update-begin---author:wangshuai ---date:20220613 for:[issues/I5BOUF]oauth2 钉钉无法登录------------ |
| | | state += "&thirdType=" + source; |
| | | //state += "&thirdType=" + "wechat_enterprise"; |