-->

j_security_check没有找到工作灯(j_security_check not found

2019-10-20 04:43发布

我想我的应用程序用户与工作灯一个LDAP模块的认证。 这是此客户端代码工作得很好:

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”。

我试过几件事情:

  1. 我把工作灯入门网站的代码示例。 它们有以下代码注销:WL.Client.logout( 'LDAPRealm',{的onSuccess:WL.Client.reloadApp})。 如果我删除了WL.Client.reloadApp部分,同样的问题比我的出现:“/应用程序/服务/ j_security_check”。

  2. 我把WL.Client.login(“LDAPRealm”)在submitForm调用服务器之前,但它不工作。

为什么这个问题是怎么回事? 是重新加载整个应用程序来解决这个问题的唯一途径? 因为它不是真正的时间效率?

非常感谢你的帮助。

Answer 1:

你应该做一个WL.Client.connect而不是WL.Client.login。 您尝试登录,同时你还没有挑战。



文章来源: j_security_check not found worklight