`
minglelui
  • 浏览: 80642 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

WebService身份验证解决方案

阅读更多

问题描述:在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;
 }


http://www.iteye.com/topic/251272

分享到:
评论
1 楼 burningman 2012-02-14  
没看明白什么意思。

相关推荐

Global site tag (gtag.js) - Google Analytics