JSD-8798 移动端单点+IP白名单
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.

61 lines
1.6 KiB

package com.fr.plugin.ipsso.handler;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.decision.webservice.v10.login.LoginService;
import com.fr.plugin.ipsso.config.PluginSimpleConfig;
import com.fr.plugin.ipsso.utils.IPWhiteUtils;
import com.fr.plugin.ipsso.utils.ResponseUtils;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@FunctionRecorder
public class GetToken extends BaseHttpHandler {
public GetToken() {
}
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/getToken";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception {
String token = "";
//获取请求参数
String clientId = req.getParameter("clientId");
String secret =req.getParameter("secret");
String username = req.getParameter("username");
PluginSimpleConfig psc = PluginSimpleConfig.getInstance();
String configClientid = psc.getAppId();
String configSecret = psc.getSecret();
if(IPWhiteUtils.inWhite(req) && clientId.equals(configClientid) && configSecret.equals(secret)){
token = LoginService.getInstance().login(req, res, username);
}
// token = LoginService.getInstance().login(req, res, username);
ResponseUtils.successResponse(res,token);
}
}