Need to authenticate WebView on UWP

Hello all,

I'm working on a project for Android, iOS, and UWP that requires web access via a WebView. The WebView also needs to be authenticated by our system, otherwise users will be met with a blank screen. I found TheRealAdamKemp's AuthenticatedWebView github repo, which works perfectly for Android and iOS, but it has no functionality for UWP. I've messed around with it in an attempt to add it myself, but some of the inclusions and references are eluding me. More specifically, both versions include a helper class in the AuthenticatingWebViewRenderer class that I can't figure out how to replicate in UWP.

AuthenticatingWebView.Droid.AuthenticatingWebViewRenderer.cs:

private class AuthenticatingWebViewClient : Android.Webkit.WebViewClient
{
    private readonly AuthenticatingWebViewRenderer _renderer;
    private readonly Android.Webkit.WebViewClient _originalClient;
    public AuthenticatingWebViewClient(AuthenticatingWebViewRenderer renderer, Android.Webkit.WebViewClient originalClient)
    {
        // 13 unique public override void functions: 
        // DoUpdateVisitedHistory, OnFormResubmission, OnLoadResource, OnPageFinished, OnPage Started, OnRecievedError,
        // OnRecievedHttpAuthRequest, OnRecievedSslError, OnScaleChanged, OnTooManyRedirects, OnUnhandledKeyEvent,
        // ShouldOverrideKeyEvent, ShouldOverrideUrlLoading
        // 2 regions of private helper functions
    }
}

AuthenticatingWebView.iOS.AuthenticatingWebViewRenderer.cs:

private class AuthenticatingWebViewDelegate : UIWebViewDelegate, INSUrlConnectionDelegate
{
    private readonly AuthenticatingWebViewRenderer _renderer;
    private readonly NSObject _originalDelegate;
    private NSUrlRequest _request;
    public AuthenticatingWebViewDelegate(AuthenticatingWebViewRenderer renderer, NSObject originalDelegate)
    {
        // 8 unique public void functions
        // override functions: LoadFailed, LoadingFinished, LoadStarted, ShouldStartLoad
        // non-override functions: WillSendRequestForAuthenticationChallenge, SendFailedNavigation, ConnectionFailed, ReceivedResponse
        // 2 regions of private helper functions
    }
}

The main thing I need help with, in order to make my own UWP version, is knowing what classes or interfaces would need to be inherited, and what functions I would need to override or implement. I don't need someone to write the entire thing for me, just point me in the right direction. (But if you do have a UWP version, I'll gladly use it)

Any help will be greatly app

Answers

Sign In or Register to comment.