j_security_check没有找到工作灯 [英] j_security_check not found worklight
问题描述
我想我的应用程序的用户与工作灯一个LDAP模块验证。
这与该客户code工作得很好:
I am trying to authenticate my application users with a LDAP module with Worklight. This is working very well with this client code :
var ldapRealmChallengeHandler = WL.Client.createChallengeHandler("LDAPRealm");
function wlCommonInit(){
WL.Client.login("LDAPRealm");
}
ldapRealmChallengeHandler.isCustomResponse = function(response) {
if (!response || response.responseText === null) {
return false;
}
var indicatorIdx = response.responseText.search('j_security_check');
if (indicatorIdx >= 0){
return true;
}
return false;
};
ldapRealmChallengeHandler.handleChallenge = function(response){
};
ldapRealmChallengeHandler.submitLoginFormCallback = function(response) {
var isLoginFormResponse = ldapRealmChallengeHandler.isCustomResponse(response);
if (isLoginFormResponse){
ldapRealmChallengeHandler.handleChallenge(response);
}
else {
ldapRealmChallengeHandler.submitSuccess();
window.location.hash = "classes";
}
};
submitLoginForm = function(username, password){
var reqURL = '/j_security_check';
var options = {};
options.parameters = {
j_username : username,
j_password : password
};
options.headers = {};
ldapRealmChallengeHandler.submitLoginForm(reqURL, options, ldapRealmChallengeHandler.submitLoginFormCallback);
}
logout = function(){
WL.Client.logout('LDAPRealm',{});
changePage(loginPage);
}
当我登录在第一时间内效果很好。不过,如果我退出,我尝试登录第二次,就会出现错误:找不到文件:/应用程序/服务/ j_security_check。
When I log in the first time it works well. However, if I logout, and I try to login a second time, an error appears : "File not found: /apps/services/j_security_check".
我试过几件事情:
-
我把在工作灯的code样品入门网站。它们具有以下code注销:
WL.Client.logout('LDA $ P $掌',{的onSuccess:WL.Client.reloadApp})。
如果我删除WL.Client.reloadApp部分,同样的问题比我出现:/应用程序/服务/ j_security_check
I took the code sample on the Worklight Getting Started website. They have the following code to logout : WL.Client.logout('LDAPRealm',{onSuccess: WL.Client.reloadApp}). If I delete the WL.Client.reloadApp part, the same problem than mine occurs : "/apps/services/j_security_check".
我把WL.Client.login在submitForm(LDA $ P $掌)调用服务器之前,但它不工作。
I put the WL.Client.login("LDAPRealm") in the submitForm before calling the server but it's not working.
为什么这个问题是怎么回事?
是重新加载整个应用程序来解决这个问题的唯一途径?因为它不是真正的时间效率......
Why this problem is happening ? Is reload the entire application the only way to solve the problem ? Because it's not really time efficient ...
非常感谢你的帮助。
推荐答案
您应该做一个WL.Client.connect而不是WL.Client.login。您尝试登录,而你还没有被激发。
You should do a WL.Client.connect instead of WL.Client.login. You are trying to login while you were not challenged yet.
这篇关于j_security_check没有找到工作灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!