mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-369: Authentication Code doesn't seem to work. -- Verified basic auth works and provided test case.
This commit is contained in:
parent
47d99e5193
commit
2fbb9c285d
3
test/AndroidManifest.xml
Normal file → Executable file
3
test/AndroidManifest.xml
Normal file → Executable file
@ -144,5 +144,8 @@
|
|||||||
<activity android:name="xhr" android:label="@string/app_name"
|
<activity android:name="xhr" android:label="@string/app_name"
|
||||||
android:configChanges="orientation|keyboardHidden">
|
android:configChanges="orientation|keyboardHidden">
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name="basicauth" android:label="@string/app_name"
|
||||||
|
android:configChanges="orientation|keyboardHidden">
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
42
test/assets/www/basicauth/index.html
Executable file
42
test/assets/www/basicauth/index.html
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||||
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>Cordova Tests</title>
|
||||||
|
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../main.js"></script>
|
||||||
|
</head>
|
||||||
|
<body onload="init();" id="stage" class="theme">
|
||||||
|
<h1>Basic Auth</h1>
|
||||||
|
<div id="info">
|
||||||
|
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||||
|
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||||
|
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||||
|
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||||
|
</div>
|
||||||
|
<div id="info">
|
||||||
|
Loading link below should be successful and show page indicating username=test & password=test. <br>
|
||||||
|
</div>
|
||||||
|
<a href="http://browserspy.dk/password-ok.php" class="btn large">Test password</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,20 +1,20 @@
|
|||||||
<!--
|
<!--
|
||||||
Licensed to the Apache Software Foundation (ASF) under one$
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file$
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information$
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file$
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the$
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance$
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at$
|
with the License. You may obtain a copy of the License at
|
||||||
$
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0$
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
$
|
|
||||||
Unless required by applicable law or agreed to in writing,$
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an$
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY$
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the$
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations$
|
specific language governing permissions and limitations
|
||||||
under the License.$
|
under the License.
|
||||||
-->
|
-->
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
@ -49,6 +49,7 @@ $
|
|||||||
</div>
|
</div>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.jqmtabbackbutton');">Backbutton jQM tab</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.jqmtabbackbutton');">Backbutton jQM tab</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backbuttonmultipage');">Backbutton with multiple pages</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backbuttonmultipage');">Backbutton with multiple pages</button>
|
||||||
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.basicauth');">Basic Authentication</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.errorurl');">Error URL</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.errorurl');">Error URL</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.htmlnotfound');">HTML not found</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.htmlnotfound');">HTML not found</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.iframe');">IFrame</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.iframe');">IFrame</button>
|
||||||
|
46
test/src/org/apache/cordova/test/basicauth.java
Executable file
46
test/src/org/apache/cordova/test/basicauth.java
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.cordova.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import org.apache.cordova.*;
|
||||||
|
import org.apache.cordova.api.LOG;
|
||||||
|
|
||||||
|
public class basicauth extends DroidGap {
|
||||||
|
@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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user