问题描述:在Lotus设计的WebService暴露给其他程序使用,公共用户调用前如何进行用户身份验证?
解决办法:在WebService的New方法中进行用户的身份验证。
http://leafyoung.cnblogs.com/archive/2004/11/20/66310.aspx
http://www.codeguru.com/Csharp/Csharp/cs_webservices/security/article.php/c5479/
http://www.iteye.com/topic/251272
首先要使用domino用户名和密码进行HTTP认证
public CommonsHttpSolrServer getSolrServer(String url) {
CommonsHttpSolrServer ret = null;
Debug("Connect to " + url);
try {
if (_idx_username.trim() != "" && _idx_password.trim() != "") {
HttpClient client = new HttpClient();
client.getState().setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT,
AuthScope.ANY_REALM),
new UsernamePasswordCredentials(_idx_username,
_idx_password));
ret = new CommonsHttpSolrServer(url, client);
} else {
ret = new CommonsHttpSolrServer(url);
}
if (ret != null) {
Debug("Connected " + ret.getBaseURL());
ret.setSoTimeout(50000); // socket read
// timeout
ret.setConnectionTimeout(5000);
ret.setDefaultMaxConnectionsPerHost(100);
ret.setMaxTotalConnections(100);
ret.setFollowRedirects(false); // defaults to false
ret.setRequestWriter(new BinaryRequestWriter());
ret.setAllowCompression(true);
ret.setMaxRetries(1);
}
} catch (MalformedURLException e) {
Error(e.getMessage());
ret = null;
}
return ret;
}