onReceivedClientCertRequest property

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebViewClient.onReceivedClientCertRequest', apiUrl: 'https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)'), IOSPlatform(apiName: 'WKNavigationDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview'), MacOSPlatform(apiName: 'WKNavigationDelegate.webView', apiUrl: 'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview'), WindowsPlatform(apiName: 'ICoreWebView2_5.add_ClientCertificateRequested', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_5?view=webview2-1.0.2849.39#add_clientcertificaterequested'), LinuxPlatform(apiName: 'WebKitAuthenticationRequest with WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.authenticate.html', note: 'WPE WebKit supports client certificate requests via the authenticate signal. ' 'Providing a certificate programmatically requires WebKit 2.34+ and the certificate must be loaded from a PEM file. ' 'PKCS12 format may not be fully supported. If the certificate cannot be loaded, PROCEED will behave like CANCEL.')])
FutureOr<ClientCertResponse?> Function(T controller, ClientCertChallenge challenge)? onReceivedClientCertRequest
final

Notify the host application to handle an SSL client certificate request. Webview stores the response in memory (for the life of the application) if ClientCertResponseAction.PROCEED or ClientCertResponseAction.CANCEL is called and does not call onReceivedClientCertRequest again for the same host and port pair. Note that, multiple layers in chromium network stack might be caching the responses.

challenge contains data about host, port, protocol, realm, etc. as specified in the ClientCertChallenge.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • challenge: all platforms

Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebViewClient.onReceivedClientCertRequest',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)',
    ),
    IOSPlatform(
      apiName: 'WKNavigationDelegate.webView',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview',
    ),
    MacOSPlatform(
      apiName: 'WKNavigationDelegate.webView',
      apiUrl:
          'https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview',
    ),
    WindowsPlatform(
      apiName: 'ICoreWebView2_5.add_ClientCertificateRequested',
      apiUrl:
          'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_5?view=webview2-1.0.2849.39#add_clientcertificaterequested',
    ),
    LinuxPlatform(
      apiName:
          'WebKitAuthenticationRequest with WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED',
      apiUrl:
          'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.authenticate.html',
      note:
          'WPE WebKit supports client certificate requests via the authenticate signal. '
          'Providing a certificate programmatically requires WebKit 2.34+ and the certificate must be loaded from a PEM file. '
          'PKCS12 format may not be fully supported. If the certificate cannot be loaded, PROCEED will behave like CANCEL.',
    ),
  ],
)
final FutureOr<ClientCertResponse?> Function(
  T controller,
  ClientCertChallenge challenge,
)?
onReceivedClientCertRequest;