mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
CB-7410 Fix Basic Authentication test
Looks like the Chromium webview does not include the port number on the hostname during the callback challenge, but the classic webview does include the port number. Handle both cases here.
This commit is contained in:
parent
4bc2051f44
commit
4a7f825cfe
@ -21,7 +21,7 @@ package org.apache.cordova.test;
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class basicauth extends DroidGap {
|
||||
public class basicauth extends CordovaActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -31,11 +31,13 @@ public class basicauth extends DroidGap {
|
||||
AuthenticationToken token = new AuthenticationToken();
|
||||
token.setUserName("test");
|
||||
token.setPassword("test");
|
||||
super.setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test");
|
||||
// classic webview includes port in hostname, Chromium webview does not. Handle both here.
|
||||
// BTW, the realm is optional.
|
||||
setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test");
|
||||
setAuthenticationToken(token, "browserspy.dk", "BrowserSpy.dk - HTTP Password Test");
|
||||
|
||||
// Add web site to whitelist
|
||||
Config.init();
|
||||
Config.addWhiteListEntry("http://browserspy.dk*", true);
|
||||
Config.getWhitelist().addWhiteListEntry("http://browserspy.dk/*", true);
|
||||
|
||||
// Load test
|
||||
super.loadUrl("file:///android_asset/www/basicauth/index.html");
|
||||
|
Loading…
Reference in New Issue
Block a user