Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在android应用程序中处理域身份验证?_Java_Android_Authentication_Https - Fatal编程技术网

Java 如何在android应用程序中处理域身份验证?

Java 如何在android应用程序中处理域身份验证?,java,android,authentication,https,Java,Android,Authentication,Https,我们有一个服务器,上面有一个web服务。要访问服务上的功能,我们需要绕过此域身份验证。我们还希望会话持续到用户选择关闭会话为止 编辑:不要绕过,我们需要对ofc进行身份验证 它基本上是说:需要身份验证。请提供您的用户名和密码 使用Xcode和objc很容易解决这个问题,但是现在我们正在为Android开发,我们还没有找到一个好的方法来处理这个域身份验证 我们不使用任何网络视图,因此不可能出现此弹出窗口 到目前为止,我们已经尝试使用ksoap2,将HttpTransportSE更改为HttpSt

我们有一个服务器,上面有一个web服务。要访问服务上的功能,我们需要绕过此域身份验证。我们还希望会话持续到用户选择关闭会话为止

编辑:不要绕过,我们需要对ofc进行身份验证

它基本上是说:需要身份验证。请提供您的用户名和密码

使用Xcode和objc很容易解决这个问题,但是现在我们正在为Android开发,我们还没有找到一个好的方法来处理这个域身份验证

我们不使用任何网络视图,因此不可能出现此弹出窗口

到目前为止,我们已经尝试使用ksoap2,将HttpTransportSE更改为HttpStranSports,但没有成功

有人处理过这事吗?如果有,你可以和我分享你的方式!J/K不,但说真的,链接到材料和指针将不胜感激


另外,请随意询问更多细节,因为我们对web服务有一定程度的完全控制

听起来您的Web服务需要某种形式的http身份验证—可能是basic或digest

如果您打算在android上使用HttpClient,下面的内容应该可以解决这个问题:

.
.

String username = ....
String password = ....
DefaultHttpClient httpClient = new DefaultHttpClient();
if (username != null) {
  httpClient.getCredentialsProvider().setCredentials(
       new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
       new UsernamePasswordCredentials(username, password));
}

.
.


httpClient.execute(your_http_request); 

.
.