提交 a945cc1e 作者: 洪东保

3.0迁移到德勤不需要从邮件中链接调转到个人会议页面

需要嵌入德勤IFrame,传入德勤TOKEN来登陆个人会议页面
父级 26c3e247
......@@ -67,8 +67,14 @@ public class UserController {
@PostMapping(value = "/emailAuth")
public R emailAuth(@Validated @RequestBody UserVo.LoginDecrypt vo) {
String decrypt = AESUtils.decrypt(vo.getData(), aseKey);
UserVo.Auth auth = JSONObject.parseObject(decrypt, UserVo.Auth.class);
return R.ok(userService.emailAuth(auth));
try {
Object token = userService.tokenAuth(vo.getData());
return R.ok(token);
} catch (Exception e) {
return R.error(e.getMessage());
}
// String decrypt = AESUtils.decrypt(vo.getData(), aseKey);
// UserVo.Auth auth = JSONObject.parseObject(decrypt, UserVo.Auth.class);
// return R.ok(userService.emailAuth(auth));
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ public interface UserService {
Object tokenAuth(ApplicationUserVO.LoginDecrypt vo);
Object tokenAuth(String token);
Object emailAuth(UserVo.Auth vo);
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ import com.cmeeting.pojo.UserAccessRecord;
import com.cmeeting.service.IUserAccessRecordService;
import com.cmeeting.service.ModulePermissionService;
import com.cmeeting.util.*;
import io.jsonwebtoken.Jwts;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
......@@ -55,6 +56,9 @@ public class UserServiceImpl implements UserService {
public String adminWhiteUsers;
@Value(value = "${permission.applicationId}")
private String permissionApplicationId;
@Value("${cimc.secret}")
private String secret;
@Resource
private ILdapService iLdapService;
@Resource
......@@ -137,6 +141,30 @@ public class UserServiceImpl implements UserService {
}
@Override
public Object tokenAuth(String data) {
String userId = Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(data)
.getBody()
.getSubject();
List<ModulePermission> auths = iModulePermissionService.list(new LambdaQueryWrapper<ModulePermission>().eq(ModulePermission::getPurpose, 0));
boolean userAccess = auths.stream().anyMatch(item -> item.getType().equals(1) && item.getRelId().equals(userId));
SysUserSync sysUserSync = sysUserSyncMapper.selectOne(new LambdaQueryWrapper<SysUserSync>().eq(SysUserSync::getUserId, userId).select(SysUserSync::getName, SysUserSync::getDeptId));
//未直接授权到人,判断是否有授权给当前登录人所在组织
if (!userAccess) {
Set<String> authDepts = auths.stream().filter(item -> item.getType().equals(0)).map(ModulePermission::getRelId).collect(Collectors.toSet());
List<String> deptPath = new ArrayList<>();
getDeptPath(deptPath, sysUserSync.getDeptId());
if (deptPath.stream().noneMatch(authDepts::contains)) {
throw new RobotBaseException("您暂无权限");
}
}
return auth(userId, sysUserSync.getName(), RecordTemplateConstant.TEMPLATE_TYPE_CUSTOM);
}
@Override
public Object emailAuth(UserVo.Auth vo) {
String userId = vo.getId();
String nick = vo.getNick();
......
......@@ -178,3 +178,4 @@ cimc:
password: 4A6BEB75A7017F4BC4D381C2CBB0E6FB
apiKey: Jj8UONm74FRxOSMnlIN95pVVUJf5Nn2D
userinfo-environment: test
secret: Nt8wi1xBhJlUk9ek54d0FI5TFpf321ZDKRqAjpSO5IVRec5UKZAkBKEsFu0W1fNkU5l0G3//jh0dq7HquWJ5/Q== #德勤TOKEN解密SECRET
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论