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); } }