我正在为我的网络应用程序使用 SSO 登录。我的代码如下所示:
@Command("doSSOLogin")
@NotifyChange("showConflictWindow")
public void doSSOLogin(@ContextParam(ContextType.VIEW) Component view) {
logger.info("Login Button is clicked..");
doSSOLoginAuthorization(LoginType.LOGIN_IF_NO_CONFLICT);
}
private void doSSOLoginAuthorization(LoginType argLoginType) {
HttpServletResponse response = getHttpServletResponse();
HttpServletRequest request = getHttpServletRequest();
if (selectedDatabase == null) {
Messagebox.show("Must select a database", "Error", Messagebox.OK,
Messagebox.ERROR);
return;
}
String Authorization = request.getHeader("Authorization");
if (Authorization == null) {
logger.info("Authoriztion is null");
response.reset();
response.setHeader("WWW-Authenticate", "NEGOTIATE");
response.setContentLength(0);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader("connectionCache", selectedDatabase.getValue());
response.setHeader("languageType", selectedLanguage.getValue());
try {
response.flushBuffer();
} catch (IOException e) {
e.printStackTrace();
}
return;
} else {
String token = Authorization.substring("NEGOTIATE ".length());
logger.info("Authoriztion is not null having token ::" + token);
if (token.startsWith("TlRM")) {
logger.debug("We do not support NTLM authentication: " + token);
System.out.println("We do not support NTLM authentication");
return;
}
}
}
当用户单击登录按钮时,它会通过此代码,并且第一次授权为空。因此,在请求标头中设置授权并要求提供窗口凭据,并且当我再次单击此按钮时,第二次获得授权。但我不想再次单击按钮,这项工作应该通过单击完成,因为它已经在我以前的应用程序中工作,但技术是 jsp。
是在我的代码中使用 ZK 还是其他东西的问题?如果您有任何回电的解决方案,请帮助我。
提前致谢!