com.worklight.wlclient.api.challengehandler

Class GatewayChallengeHandler

  • All Implemented Interfaces:
    WLResponseListener


    public abstract class GatewayChallengeHandler
    extends BaseChallengeHandler
    implements WLResponseListener
    You use this abstract base class to create a custom challenge handler to handle responses from a third party gateway. You must extend this class to implement your own challenge handler logic.
    • Constructor Summary

      Constructors 
      Constructor and Description
      GatewayChallengeHandler(java.lang.String gatewayName)
      Constructs an GatewayChallengeHandler with a specific 'gatewayName'.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      abstract boolean canHandleResponse(WLResponse response)
      This method must be overridden by extending the GatewayChallengeHandler class.
      protected void submitLoginForm(java.lang.String requestURL, java.util.Map requestParameters, java.util.Map requestHeaders, int requestTimeoutInMilliseconds, java.lang.String requestMethod)
      You use this method to send collected credentials to a specific URL.
      protected void submitSuccess(WLResponse response)
      You must call this method when the challenge is answered successfully, for example after the user successfully submits the login form.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_TIMEOUT_IN_MILLISECONDS

        public static int DEFAULT_TIMEOUT_IN_MILLISECONDS
    • Constructor Detail

      • GatewayChallengeHandler

        public GatewayChallengeHandler(java.lang.String gatewayName)
        Constructs an GatewayChallengeHandler with a specific 'gatewayName'.
    • Method Detail

      • submitSuccess

        protected void submitSuccess(WLResponse response)
        You must call this method when the challenge is answered successfully, for example after the user successfully submits the login form. Then, this method sends the original request. Calling this method informs MobileFirst Platform that the challenge was successfully handled. This method can also be used to inform MobileFirst Platform that the response that was received is not a custom response that your challenge handler can handle. In this case, control is returned to MobileFirst Platform to handle the response.
        Parameters:
        response - The received WLResponse.
      • canHandleResponse

        public abstract boolean canHandleResponse(WLResponse response)
        This method must be overridden by extending the GatewayChallengeHandler class. In most cases, you call this method to test whether there is a gateway challenge to be handled in the response. If the method returns true, the IBM MobileFirst Platform calls the BaseChallengeHandler.handleChallenge(Object) method.
        Parameters:
        response - The response to be tested.
      • submitLoginForm

        protected void submitLoginForm(java.lang.String requestURL,
                           java.util.Map requestParameters,
                           java.util.Map requestHeaders,
                           int requestTimeoutInMilliseconds,
                           java.lang.String requestMethod)
        You use this method to send collected credentials to a specific URL. You can also specify request parameters, headers, and timeout. The success/failure delegate for this method is the instance itself (the instance of GatewayChallengeHandler), so you must override the WLResponseListener.onSuccess(WLResponse) / WLResponseListener.onFailure(com.worklight.wlclient.api.WLFailResponse) methods.
        Parameters:
        requestURL - Absolute URL if the user sends an absolute URL that starts with http:// or https:// Otherwise, URL relative to the MobileFirst Platform Server.
        requestParameters - The request parameters.
        requestHeaders - The request headers.
        requestTimeoutInMilliseconds - To supply custom timeout, use a number over 0.
        If the number is under 0, the IBM MobileFirst Platform framework uses the default timeout, which is 10,000 milliseconds.
        requestMethod - The HTTP method that you must use.
        Acceptable values are GET, POST.
        The default value is POST.


© Copyright IBM Corp. 2006, 2015. All Rights Reserved.