/** * On received http auth request. The method reacts on all registered authentication tokens. There * is one and only one authentication token for any host + realm combination * * @param view * @param handler * @param host * @param realm */ @Override public void onReceivedHttpAuthRequest( XWalkView view, XWalkHttpAuthHandler handler, String host, String realm) { // Get the authentication token AuthenticationToken token = getAuthenticationToken(host, realm); if (token != null) { handler.proceed(token.getUserName(), token.getPassword()); } else { // Handle 401 like we'd normally do! super.onReceivedHttpAuthRequest(view, handler, host, realm); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // LogCat: onReceivedHttpAuthRequest(browserspy.dk:80,BrowserSpy.dk - HTTP Password Test) AuthenticationToken token = new AuthenticationToken(); token.setUserName("test"); token.setPassword("test"); super.setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test"); // Add web site to whitelist super.appView.addWhiteListEntry("http://browserspy.dk*", true); // Load test super.loadUrl("file:///android_asset/www/basicauth/index.html"); }