You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.5 KiB

package com.fr.plugin.web.hander;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.utils.YiTuanMaUtils;
import com.fr.stable.StringUtils;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import com.fr.web.utils.WebUtils;
import io.netty.util.internal.StringUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class GetTicketHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return null;
}
@Override
public String getPath() {
return "/yt/ticket";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest req, HttpServletResponse httpServletResponse) throws Exception {
JSONObject jsonObject=new JSONObject();
String clientId = req.getParameter("clientId");
String ticket = YiTuanMaUtils.getTicket(clientId);
if (StringUtils.isBlank(ticket)) {
FineLoggerFactory.getLogger().info("==================== 单点登录获取缓存ticket失败,通过配置获取");
ticket = YiTuanMaUtils.getTicketWithToken(clientId,YiTuanMaUtils.getAccessTokenFromAPI(clientId));
FineLoggerFactory.getLogger().info("==================== 单点登录通过配置获取ticket为:" + ticket);
}
jsonObject.put("ticket", ticket);
WebUtils.printAsJSON(httpServletResponse,jsonObject);
}
}