BIP单点登录
This commit is contained in:
parent
9720083622
commit
db4ed30db8
|
@ -28,4 +28,13 @@ public interface IBipSsoService extends IBaseService<BipTokenVo,String>{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SysExtensionApiEntity ssoEncrypt(SysExtensionApiEntity entity);
|
SysExtensionApiEntity ssoEncrypt(SysExtensionApiEntity entity);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 天智单点登录
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/7/8 0008 10:34
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
String biSso(HttpServletRequest request, String ticket);
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import cn.hutool.http.HttpException;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
|
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
|
||||||
import com.hzya.frame.bip.v3.v2207.service.IBipSsoService;
|
import com.hzya.frame.bip.v3.v2207.service.IBipSsoService;
|
||||||
|
@ -111,6 +112,30 @@ public class BipSsoServiceImpl extends BaseService<BipTokenVo, String> implement
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String biSso(HttpServletRequest request, String ticket) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("username","admin");
|
||||||
|
obj.put("password","hzya@1314");
|
||||||
|
try {
|
||||||
|
String result = HttpRequest.post("http://192.168.2.237:9191/api/rest/user/login/")
|
||||||
|
// .header("Content-Type", "application/x-www-form-urlencoded")//头信息,多个头信息多次调用此方法即可
|
||||||
|
// .header("Content-Length", "10000")//头信息,多个头信息多次调用此方法即可
|
||||||
|
// .header("userid", "admin")//头信息,多个头信息多次调用此方法即可
|
||||||
|
.body(obj.toString())//表单内容
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
JSONObject resultObj = JSON.parseObject(result);
|
||||||
|
String token = resultObj.getString("token");
|
||||||
|
String ssoUrl = "http://192.168.2.237:9191/bi/admin";
|
||||||
|
return ssoUrl+"?token="+token;
|
||||||
|
} catch (HttpException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "http://192.168.2.237:9191/bi/login";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**获取NCC的key*/
|
/**获取NCC的key*/
|
||||||
private static String genKey(String userid, String key) throws Exception {
|
private static String genKey(String userid, String key) throws Exception {
|
||||||
return new Base64().encodeToString(SignatureTookKit.digestSign(userid.getBytes(), key.getBytes()));
|
return new Base64().encodeToString(SignatureTookKit.digestSign(userid.getBytes(), key.getBytes()));
|
||||||
|
|
Loading…
Reference in New Issue