remove LDAP
This commit is contained in:
parent
329f071e09
commit
2dbcb0652c
@ -49,7 +49,6 @@ public enum ResponseStatus {
|
||||
CRM_TOKEN_ERROR(2008, "CRM token 错误"),
|
||||
CRM_TOKEN_TIME_OUT(2009, "CRM REFRESH TOKEN 超时"),
|
||||
USER_BLACK_LIST_ERROR(2010, "禁止登陆"),
|
||||
LDAP_LOGIN_ERROR(2011, "LDAP登录失败"),
|
||||
NO_ACTIVE_USER_DEPT(2012, "用户没有配置有效部门"),
|
||||
|
||||
/*********************外部系统***********************/
|
||||
|
||||
@ -6,7 +6,6 @@ import com.upchina.common.result.CommonResult;
|
||||
import com.upchina.common.vo.AuthVO;
|
||||
import com.upchina.common.vo.BackendUserVO;
|
||||
import com.upchina.rbac.query.ChangeMobileQuery;
|
||||
import com.upchina.rbac.query.LdapLoginQuery;
|
||||
import com.upchina.rbac.query.LoginDeptQuery;
|
||||
import com.upchina.rbac.query.LoginQuery;
|
||||
import com.upchina.rbac.service.AuthService;
|
||||
@ -45,13 +44,6 @@ public class AuthController {
|
||||
return CommonResult.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("新登录LDAP")
|
||||
@PostMapping("/loginNew")
|
||||
public CommonResult<AuthVO> loginNew(@Validated @RequestBody @ApiParam(required = true) LdapLoginQuery query) {
|
||||
AuthVO vo = authService.loginNew(query);
|
||||
return CommonResult.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("选择部门")
|
||||
@PostMapping("/selectDept")
|
||||
public CommonResult<List<DeptVO>> selectDept(@RequestAttribute(value = "backendUser", required = false) BackendUserVO userVO) {
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
package com.upchina.rbac.query;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
public class LdapLoginQuery {
|
||||
|
||||
@ApiModelProperty(value = "LDAP Key", required = true)
|
||||
@NotBlank
|
||||
private String ldapKey;
|
||||
|
||||
public String getLdapKey() {
|
||||
return ldapKey;
|
||||
}
|
||||
|
||||
public void setLdapKey(String ldapKey) {
|
||||
this.ldapKey = ldapKey;
|
||||
}
|
||||
}
|
||||
@ -57,12 +57,6 @@ public class AuthService {
|
||||
@Value("${user.admin.roles}")
|
||||
private String admin_user_roles;
|
||||
|
||||
@Value("${ldap.host}")
|
||||
private String ldapHost;
|
||||
|
||||
@Value("${ldap.path}")
|
||||
private String ldapPath;
|
||||
|
||||
@Resource
|
||||
private UserLoginMapper userLoginMapper;
|
||||
|
||||
@ -97,11 +91,6 @@ public class AuthService {
|
||||
return getLoginAuthVO(query.getLoginName(), query.getPassword());
|
||||
}
|
||||
|
||||
public AuthVO loginNew(LdapLoginQuery query) {
|
||||
String uid = checkLdap(query.getLdapKey());
|
||||
return getLoginAuthVO(uid, null);
|
||||
}
|
||||
|
||||
public List<DeptVO> selectDept(BackendUserVO userVO) {
|
||||
if (userVO == null || userVO.getLoginId() == null) {
|
||||
throw new BizException(ResponseStatus.SESSION_EXPIRY);
|
||||
@ -309,38 +298,6 @@ public class AuthService {
|
||||
throw new BizException("用户类型错误");
|
||||
}
|
||||
|
||||
public String checkLdap(String ldapKey) {
|
||||
JSONObject requestData = new JSONObject();
|
||||
JSONObject reqData = new JSONObject();
|
||||
reqData.set("LDAPKey", ldapKey);
|
||||
requestData.set("req", reqData);
|
||||
|
||||
String response = HttpRequest.post(ldapHost + ldapPath)
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.body(requestData.toString())
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
JSONObject res = JSONUtil.parseObj(response);
|
||||
JSONObject ldapRsp = res.getJSONObject("rsp");
|
||||
|
||||
if (ldapRsp == null) {
|
||||
throw new BizException(ResponseStatus.LDAP_LOGIN_ERROR, "LDAPKey校验失败:" + response);
|
||||
}
|
||||
|
||||
Integer ret = ldapRsp.getInt("ret");
|
||||
if (ret == null || ret != 0) {
|
||||
throw new BizException(ResponseStatus.LDAP_LOGIN_ERROR, "LDAPKey校验失败:" + ldapRsp.getInt("ret"));
|
||||
}
|
||||
|
||||
long expireTime = ldapRsp.getLong("expireTime");
|
||||
if (expireTime * 1000 <= System.currentTimeMillis()) {
|
||||
throw new BizException(ResponseStatus.SESSION_EXCEED);
|
||||
}
|
||||
|
||||
return ldapRsp.getStr("uid");
|
||||
}
|
||||
|
||||
private AuthVO getLoginAuthVO(String loginName, String password) {
|
||||
// 校验用户
|
||||
LambdaQueryWrapper<UserLogin> userLoginWrapper = Wrappers.<UserLogin>lambdaQuery()
|
||||
|
||||
@ -6,9 +6,6 @@ rsa:
|
||||
priKey: "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANkA6AlVLJC5TjnY5pAbdfA413R2zJ8++0Axm6AOL2SehH1+EmtRTchkc3PPrXu0U/6eqJmtloNHTh3fmD1hlowy7cuewM2lNPifd4dagR/YIno8ci1usTxNd8bugMEQN+20tBLarcrIlY0BC2i25CuK6w5ynQCBeLdfJ5AvUXAZAgMBAAECgYEAusC18Lo1hUOEl/Ib0q9fW2J/wcIvrWjVb9SBm0g57z0gxqNGFMe+yhPw7B0xrwFtO/atILysiMRH7RuteD3RAbdZQl4r3Hz2jA/YjIgfu/KcdENvCYD5X5AhbflOSyvn4mzGvzyPmS6H6Hlr7UI3/dknq4OiTDXD9M06gNK53gECQQDwk/Ui7rtfo1TcCkyrTlirGy1kHDcl9EgPfcQSVlZJICTVmvT1d9MmLcVtFezadmWP/9QxdJtPbfWXMvby4ftBAkEA5uoTvl1girN9q8IIZ1PpcE17TASexzKcFIpweMVkXQEbTxq7ijqRAQ9MONjj2gtzaXB6c6P9sIOP/Pt74JP22QJAbd6Ec2GnvPOwy5UAkrODFxGgVznzjafUSQ7cvqsjWN4PNGZCPOBuU99PbJQ4yUSM+YiSdcuVKl9Da7vgv+eogQJBAKirbNaNoJpP98kBR2AqhAabIifp7Az3I9lBMlyVWvUwfMEwdrLGiuqqQPP5QZ4g5SGsnlVgAUvxHbkd/WOS0SkCQCK30/4rdyWTNvR38O8KYSx76Dxj7OKYO4xZGoQL9Pgv05Ua4LfyZHdNaPmspLNEqxfgKObzJWiTwic2+JDsG/w="
|
||||
des:
|
||||
key: upchina2
|
||||
ldap:
|
||||
host: https://prx.test.upchina.com
|
||||
path: /json/ldap_server/checkLDAPKey
|
||||
file:
|
||||
domain:
|
||||
prefix: https://advisorimg.test.upchina.com/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user