title: LTPA ChallengeHandler Javascript MFP8
body: <p>I'm working on the new Platform MFP8 and I want to implement an LTPA Authentication in an hybrid application. Searching in the web I found a Swift implementation of LTPA ChallengeHandler (<a href="https://github.com/mfpdev/ldap-and-ltpa-sample/tree/master/LTPABasedSample" rel="nofollow noreferrer">https://github.com/mfpdev/ldap-and-ltpa-sample/tree/master/LTPABasedSample</a>). But, if I try to replicate the same behaviour in a JS challengeHandler, it doesn't work.
  Below my challengeHandler implementation:</p>
  
  <pre><code>var UserLoginChallengeHandler = function() {
      var isChallenged = false;
      var securityCheckName = 'LTPA';
      var URL;
      var userLoginChallengeHandler = WL.Client.createSecurityCheckChallengeHandler(securityCheckName);
  
      document.getElementById("login").addEventListener("click", login);
  
      userLoginChallengeHandler.securityCheckName = securityCheckName;
  
      userLoginChallengeHandler.handleChallenge = function(challenge) {
          WL.Logger.debug("handleChallenge");
          showLoginDiv();
          isChallenged = true;
          URL = challenge.loginURL;
      };
  
      userLoginChallengeHandler.handleSuccess = function(data) {
          WL.Logger.debug("handleSuccess");
          isChallenged = false;
          showProtectedDiv();
      };
  
      userLoginChallengeHandler.handleFailure = function(error) {
          WL.Logger.debug("handleFailure: " + error.failure);
          isChallenged = false;
          if (error.failure !== null){
              alert(error.failure);
          } else {
              alert("Failed to login.");
          }
      };
  
      function login() {
  
          var basic = "Basic YWRtaW46YWRtaW4="; //base64 of admin:admin 
          $.ajax({
            type: "POST",
            url: URL,
            headers: {
              "Authorization": basic
            },
            success: function(data, status, xhr){
              console.log(data);
              userLoginChallengeHandler.submitChallengeAnswer({});
            },
            error: function(jqXhr, status, error){
              console.log(error);
            }
          });
      }
  
      return userLoginChallengeHandler;
  
  };
  </code></pre>
  
  <p>When I submit the request for plain-war application, the principal in the authorize method of LTPASecurityCheck results null.
  Instead, if I execute the iOS example application, the principal is valued and the authentication occurs.</p>
  
  <p>Have you any idea to resolve this strange behavior?</p>
  
  <p>Thanks a lot,
  Stefano</p>