submitLoginForm()不会将数据发送到身份验证服务器 - MobileFirst Cordova客户端

时间:2016-05-31 05:36:16

标签: javascript cordova ibm-mobilefirst

我正在尝试在MobileFirst平台上编写cordova混合应用程序测试应用程序。在我的挑战处理程序中,我已经包含了一个代码,用于使用submitLoginForm()java脚本API将登录信息发送到我的身份验证服务器。

如果生成了对我的身份验证服务器的任何身份验证请求,我会使用wireshark检查,但事实并非如此。

您能否帮我确认一下我的代码问题?

我可以看到警告,直到 Inside handleChallenge3 ,但没有看到关闭挑战处理程序的警告。

还有一件事,我正在尝试使用isCustomResponse()API来查看我的挑战处理程序会遇到什么样的质询/响应,但似乎没有被触发。这是否已在MobileFirst Platform 8中弃用?

由于

var LtpaAuthChallengeHandler = function(){
      LtpaAuthChallengeHandler = WL.Client.createWLChallengeHandler("LtpaBasedSSO");

      LtpaAuthChallengeHandler.isCustomResponse = function(transport) {
        alert ("Inside isCustomResponse");
        return true;
      };

      LtpaAuthChallengeHandler.loginResponse = function(response) {
        alert ("Inside loginResponse");
        LtpaAuthChallengeHandler.submitSuccess();
        alert ("After loginResponse");
      };
      // handleFailure
      LtpaAuthChallengeHandler.handleFailure = function(error) {
         // WL.Logger.debug("Challenge Handler Failure!");
          if(error.failure !== null && error.failure !== undefined){
             alert(error.failure);
          }
          else {
             alert("Unknown error");
          }
      };

      LtpaAuthChallengeHandler.handleChallenge = function(challenge) {
        alert ("Inside handleChallenge");
        var msg = "";
    alert ("Inside handleChallenge1");
        var options = {
          "headers"     : {},
          "parameters"  : {
            "username" : "admin",
            "password" : "admin",
            'login-form-type' : 'pwd'
          }
        };
    alert ("Inside handleChallenge2");
        var loginUrl = "<URI for forms based auth of auth server>";
    alert ("Inside handleChallenge3");
        LtpaAuthChallengeHandler.submitLoginForm (loginUrl, options, LtpaAuthChallengeHandler.loginResponse);

        alert ("Closing Challenge Handler");
      };
    };

1 个答案:

答案 0 :(得分:1)

从UI收集凭据后,使用WLChallengeHandler的isCustomResponse()将答案发回安全检查。

var App = angular.module('App', ['ngRoute', 'ngMaterial', 'ui-notification', 'ngFileUpload']); App.run(['$rootScope', '$location', function($rootScope, $location) { console.log("TEST"); }]); App.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { // TODO: routing }]); App.factory('file-uploader', ['Upload', function(Upload) { var uploadFile = function(file, callback) { var uploader; uploader = Upload.upload({ url: 'SERVER URL' + '/upload-file', data: { image: file } }); uploader.then(function(fileData) { return callback(null, fileData); }); uploader.catch(function(error) { return callback(error, null); }); }; return uploadFile; }]); 不适用于MFP 8.0。

请参阅身份验证和安全主题here