Package com.subaio.fintechbridge
Class RequestHandler
java.lang.Object
com.subaio.fintechbridge.RequestHandler
- Direct Known Subclasses:
NativeRequestHandler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
enhanceConnection
(HttpsURLConnection connection) Modify the connection-object before it is opened.protected android.webkit.WebResourceResponse
getFlattenedHeaders
(Map<String, List<String>> headers) android.webkit.WebResourceResponse
Handle a single request made either as part of bridge initialization or from a webviewboolean
Determines whether the requesthandler is used.protected static void
setHeaders
(HttpsURLConnection connection, Map<String, String> headers)
-
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
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
- URLmethod
- HTTP methodheaders
- Lookup of request headersbody
- 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
-
setHeaders
protected static void setHeaders(@NonNull HttpsURLConnection connection, Map<String, String> headers)
-