|
|
|
@ -6,6 +6,7 @@ package com.ruoyi.jjh.declaration.single.controller;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import cn.hutool.crypto.digest.DigestUtil;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
@ -81,7 +82,7 @@ public class SingleLoginController {
|
|
|
|
|
@GetMapping("/login")
|
|
|
|
|
public void login(HttpServletResponse response) throws IOException {
|
|
|
|
|
//变成参数模式,appid 用于校验提交的来源地址,生产环境会校验,试用环境暂不校验
|
|
|
|
|
String scUrl = "clientUrl=" + URLEncoder.encode(returnUrl, "UTF-8") + "?appid=" + enterpriseAppId;
|
|
|
|
|
String scUrl = "clientUrl=" + URLEncoder.encode(returnUrl, "UTF-8") + "&appid=" + enterpriseAppId;
|
|
|
|
|
//加密后的客户端地址
|
|
|
|
|
scUrl = Base64.getEncoder().encodeToString(scUrl.getBytes());
|
|
|
|
|
//最终跳转地址
|
|
|
|
@ -101,10 +102,11 @@ public class SingleLoginController {
|
|
|
|
|
@ApiOperation(value = "获取用户信息", response = UserResponse.class)
|
|
|
|
|
@GetMapping("/getInfo")
|
|
|
|
|
public AjaxResult getInfo(String clientToken) throws Exception {
|
|
|
|
|
HttpResponse response = HttpUtil.createGet(infoUrl)
|
|
|
|
|
HttpResponse response = HttpRequest.get(infoUrl)
|
|
|
|
|
.form("clienttoken", clientToken)
|
|
|
|
|
// .addHeaders(generationHeader())
|
|
|
|
|
.addHeaders(generationHeader())
|
|
|
|
|
.execute();
|
|
|
|
|
System.out.println(response.body());
|
|
|
|
|
String responseBody;
|
|
|
|
|
// 获取响应状态码
|
|
|
|
|
int statusCode = response.getStatus();
|
|
|
|
@ -158,7 +160,7 @@ public class SingleLoginController {
|
|
|
|
|
public AjaxResult enterpriseLogout(@RequestParam("clienttoken") String clienttoken) {
|
|
|
|
|
String url = logoutUrl + "?clienttoken=" + clienttoken;
|
|
|
|
|
HttpResponse execute = HttpUtil.createGet(url)
|
|
|
|
|
// .addHeaders(generationHeader())
|
|
|
|
|
.addHeaders(generationHeader())
|
|
|
|
|
.execute();
|
|
|
|
|
String str;
|
|
|
|
|
// 获取响应状态码
|
|
|
|
|