Currently there is a bug in Android webkit that basic authentication for a
web resource will only fire once. You can test this by logging all the
things with this method;

*@Override*
*public android.webkit.WebResourceResponse
shouldInterceptRequest(android.webkit.WebView view, java.lang.String url) {
}*

This is a real ball ache if you have a resources on another server with
different BA credentials.

If you listen for

*@Override*
*public void onReceivedHttpAuthRequest(android.webkit.WebView view,
android.webkit.HttpAuthHandler handler, java.lang.String host,
java.lang.String realm) { }*

You can set your own credentials with the following example in the above
method;

String[] credentials = view.getHttpAuthUsernamePassword(host, realm);
handler.proceed(credentials[0], credentials[1]);

Anyhow, *both the above methods are currently on CordovaWebViewClient*.
Getting access to these was a b****h.
Exposing these to the Plugin would be totally badass.
I can submit something for this but it's pretty big.
Would like to know what the consensus is on this first. People?



On Wed, Aug 21, 2013 at 3:48 AM, Ally Ogilvie <[email protected]> wrote:

> I think there is a requirement to offer this at the plugin level at
> least. Basic authentication is an obvious one.
> Try load an image with a source where the URL is basic authenticated.
> Good luck :)
>
> Some additional overrides are necessary.
>
> Sent from my Windows Phone From: [email protected]
> Sent: 20/08/2013 23:12
> To: [email protected]
> Subject: RE: Extending CordovaWebView
> On Mon Aug 19 05:21 PM, Ian Clelland wrote:
> > On Mon, Aug 19, 2013 at 4:43 PM, Joe Bowser <[email protected]> wrote:
> >
> > >
> > > I don't think that we should replace Java code with XML.  This is a
> > > lot different than just reading constants from an XML file.  If you're
> > > going to mess around with the webview, you should be forced to
> > > understand what you're doing.  It's already bad enough that hardly
> > > anybody reads the plugin code before they cram it into their projects.
> > >
> >
> > It's not replacing Java code with XML -- if anything, it's *more* Java
> > code :).
> > Just using reflection to instantiate the correct classes,
> > exactly like plugin
> > installation / invocation.
>
> I'm somewhat for the idea but it seems too early to start thinking how
> this would be implemented.
> Maybe it turns out there's only 2-5 plugins that would need this.
>
> One thing that could help is an <experimental></experimental> section
> in plugin.xml to try different approaches.
> That part could break at any time, if there's eventually consensus on
> the feature and syntax, it gets merged in plugin.xml
>



-- 
<http://www.wizcorp.jp/>Ally Ogilvie
Lead Developer - MobDev. | Wizcorp Inc. <http://www.wizcorp.jp/>
------------------------------
TECH . GAMING . OPEN-SOURCE WIZARDS+ 81 (0)3-4550-1448 |
Website<http://www.wizcorp.jp/>
 | Twitter <https://twitter.com/Wizcorp> |
Facebook<http://www.facebook.com/Wizcorp>
 | LinkedIn <http://www.linkedin.com/company/wizcorp>

Reply via email to