Class RequestHandler

java.lang.Object
com.subaio.fintechbridge.RequestHandler
Direct Known Subclasses:
NativeRequestHandler

public abstract class RequestHandler extends Object
Abstract handler for handling SSL pinning and other authentication tasks. Override `enhanceConnection` to simply add SSL pinning before the connection is opened. Override `handle` for more fine-grained control of the connection. Override `isEnabled` to control when the handler should be used. Defaults to SDK versions before 24
  • Constructor Details

    • RequestHandler

      public RequestHandler()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Determines whether the requesthandler is used. Defaults to checking for SDKs below 24, since this is where native SSL pinning was added.
      Returns:
      Is request handling necessary
    • enhanceConnection

      public abstract void enhanceConnection(@NonNull HttpsURLConnection connection)
      Modify the connection-object before it is opened.
    • handle

      public android.webkit.WebResourceResponse handle(@NonNull URL url, @NonNull String method, @NonNull Map<String,String> headers, String body)
      Handle a single request made either as part of bridge initialization or from a webview
      Parameters:
      url - URL
      method - HTTP method
      headers - Lookup of request headers
      body - Optional body content
      Returns:
      The result of an authenticated request. Returning null will fail the request with status 526
    • getDefaultError

      @NonNull protected android.webkit.WebResourceResponse getDefaultError()
    • getFlattenedHeaders

      protected static Map<String,String> getFlattenedHeaders(@NonNull Map<String,List<String>> headers)
    • setHeaders

      protected static void setHeaders(@NonNull HttpsURLConnection connection, Map<String,String> headers)