我正在努力增强现有的GWT项目,我正在使用PING添加身份验证。
以下是流程:
我在下面添加了一个过滤器:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
def lotka(x,t,params):
N, P = x
alpha, beta, gamma, delta = params
derivs = [alpha*N - beta*N*P, gamma*N*P - delta*P]
return derivs
N=2
P=1
alpha=3
beta=0.5
gamma=0.4
delta=3
params = [alpha, beta, gamma, delta]
x0=[N,P]
maxt = 20
tstep = 0.01
t=np.arange(0,maxt,tstep)
equation=odeint(lotka, x0, t, args=(params,))
plt.plot(t,equation)
plt.xlabel("Time")
plt.ylabel("Population size")
plt.legend(["Prey", "Predator"], loc="upper right")
plt.title('Prey & Predator Static Model')
plt.grid(color="b", alpha=0.5, linestyle="dashed", linewidth=0.5)
但问题是我的请求URI没有代码参数。
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
System.out.println(httpRequest);
String requestURI = httpRequest.getParameter("code");
System.out.println(requestURI);
if (!requestURI.contains("code")) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.sendRedirect("https://pingwebsite/as/authorization.oauth2?client_id=XXX&response_type=code");
}
filterChain.doFilter(request, response);
}
打印 - library-ui。
一旦我从URL获取代码,我就可以继续进行。
答案 0 :(得分:0)
我能够解决这个问题,我不得不使用window.location从浏览器获取详细信息并对服务器端执行RPC调用。然后我不得不用PING请求带有授权码的Jwt令牌并验证它。