【问题标题】:How can use web services to validate username and password in worklight Adapter based authentication?如何使用 Web 服务在基于 Worklight 适配器的身份验证中验证用户名和密码?
【发布时间】:2023-04-08 15:54:01
【问题描述】:
singleStepAuthRealmChallengeHandler.handleChallenge = function(response){
var authRequired = response.responseJSON.authRequired;
user_id=response.responseJSON.loginUser;
if (authRequired == true){
    $("#AppDiv").hide();
    $("#AuthDiv").show();
    $("#AuthPassword").empty();
    $("#AuthInfo").empty();
   if (response.responseJSON.errorMessage){
        $("#AuthInfo").html(response.responseJSON.errorMessage);
   }

} else if (authRequired == false){

$('#AuthSubmitButton').attr('href','home.html');
    $("#AuthSubmitButton").click();
    $("#AuthSubmitButton").click();
    singleStepAuthRealmChallengeHandler.submitSuccess();
}};
$("#AuthSubmitButton").bind('click', function () {
var username = $("#AuthUsername").val();
var password = $("#AuthPassword").val();

var invocationData = {
    adapter : "SingleStepAuthAdapter",
    procedure : "verifyLogin",
    parameters : [ username, password ]
};

var options= {
        onSuccess: success,
        onFailure: failure`enter code here`
};
WL.Client.invokeProcedure(invocationData, options);});
function success(response)
{
var result=JSON.stringify(response);
var invocationData = {
        adapter : "SingleStepAuthAdapter",
        procedure : "submitAuthentication",
        parameters : [ result ]
    };
singleStepAuthRealmChallengeHandler.submitAdapterAuthentication(invocationData, {});}

这个方法对吗???当我用户登录时它不起作用不会重定向到主页。 :-(

首先,我尝试调用程序从服务器获取用户名密码,并在成功功能中调用提交身份验证,但是当用户登录时,下次访问安全程序时,它不会直接重定向到主页而不是它说用户已经登录它假设运行 get authrequired = false 并转到主页。

我正在使用rest api获取用户名和密码并传递给submitauthentication函数。

是不是因为调用两次有问题我无法弄清楚请帮忙。

【问题讨论】:

  • 得到了简单的解决方案:-)

标签: ibm-mobilefirst worklight-adapters worklight-security


【解决方案1】:

我在服务器端验证了用户名密码本身称为适配器混搭。您可以参考此链接Mashup

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-13
    • 1970-01-01
    • 2014-03-26
    相关资源
    最近更新 更多