Closed seawenc closed 3 years ago
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en,zh;q=0.9
Connection: keep-alive
Cookie: JSESSIONID=node0dnj5mctdkav2ampo9n21qkxd1.node0
Host: qualitis.b.x
Referer: http://dss.b.x/
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
redirect: http://qualitis.b.x:80/#/addGroupTechniqueRule?tableType=1&id=1&ruleGroupId=undefined&nodeId=9256a408-8c3e-4e78-8804-a740f0331681
dssurl: http://dss.b.x
cookies: bdp-user-ticket-id=3cSULn63z6ChSy5x2BK4wYP3d14cjuVE
By catching net packets, i found qualitis request gateway miss cookies param
modify AppJointAuthImpl.scala to fix it:
override def getRedirectMsg(request: HttpServletRequest): RedirectMsg = {
val dssUrl = request.getParameter(AppJointAuthImpl.DSS_URL_KEY)
val dwsHttpClient = getDWSClient(dssUrl)
val userInfoAction = new UserInfoAction
val cookies = request.getParameter(AppJointAuthImpl.COOKIES_KEY)
// 由于向dss请求少了对cookies,导致网关报没登录,此bug最根源应该是在AbstractHttpClient.executeHttpAction中,但此类太公共,怕改出问题,因此只在此处改
var strcookies = userInfoAction.getHeaders.get("Cookie")
if(strcookies==null){
strcookies=""
}
cookies.split(";").foreach { cookie =>
val index = cookie.indexOf("=")
val key = cookie.substring(0, index).trim
val value = cookie.substring(index + 1).trim
userInfoAction.addCookie(new BasicClientCookie(key, value))
strcookies= s"$key=$value;"+strcookies;
}
userInfoAction.addHeader("Cookie",strcookies)
val redirectMsg = new RedirectMsgImpl
redirectMsg.setRedirectUrl(request.getParameter(AppJointAuthImpl.REDIRECT_KEY))
dwsHttpClient.execute(userInfoAction) match {
case userInfoResult: UserInfoResult =>
redirectMsg.setUser(userInfoResult.getUserName)
}
redirectMsg
}
links version:0.9.0 qualitis version: 0.8.0
qualitis error log: