单点登录
This commit is contained in:
+4
-2
@@ -645,9 +645,11 @@ public class LoginController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "单点登录")
|
||||
@PostMapping(value = "/singleSignON")
|
||||
public Result<?> singleSignON(@RequestParam(name="code") String code) {
|
||||
@PostMapping(value = "/singleSignOn")
|
||||
public Result<?> singleSignOn(@RequestParam(name="code") String code) {
|
||||
Result<JSONObject> result = new Result<>();
|
||||
|
||||
sysUserService.singleSignOn(code);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@ import com.jero.modules.system.model.SysLoginVO;
|
||||
import com.jero.modules.system.model.SysUserSysDepartModel;
|
||||
import com.jero.modules.system.vo.SysUserVo;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -263,6 +264,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||
*/
|
||||
PayContactsManagement getPayContactsManagementByPhone(String phone);
|
||||
|
||||
|
||||
//单点登录
|
||||
void singleSignOn(String code);
|
||||
|
||||
}
|
||||
|
||||
+15
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -73,6 +74,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
private RedisUtil redisUtil;
|
||||
@Value("${defaultPassword}")
|
||||
private String defaultPassword;
|
||||
@Value("${singleSignON.client_id}")
|
||||
private String client_id;
|
||||
@Value("${singleSignON.client_id}")
|
||||
private String client_secret;
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
|
||||
@@ -620,6 +625,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
if(ObjectUtils.isEmpty(user.getVerifyPassword())){
|
||||
throw new JeroBootException("确认密码为必填");
|
||||
}
|
||||
}
|
||||
|
||||
//单点登录
|
||||
public void singleSignOn(String code){
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("client_id", client_id);
|
||||
paramMap.put("client_secret", client_secret);
|
||||
paramMap.put("code", 1);
|
||||
paramMap.put("grant_type", "authorization_code");
|
||||
|
||||
String token= HttpUtil.post("https://idmtest.catarc.ac.cn/bam-protocol-service/oauth2/getToken", paramMap);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user