WCF模拟Salesforce.com登录服务

时间:2010-06-11 18:12:02

标签: wcf binding token salesforce

我如何完成Salesforce.com使用WCF登录的功能?我想有一个身份验证服务,在正确的登录时返回一个令牌。然后,每组服务调用都会将令牌传回。我不想在每个方法调用上传递令牌。

什么是扔我的是会话标头是如何绑定的一部分。

我也在寻找为什么这个或不是个好主意。我认为它干净简单。

谢谢!

 // Create service object   

  binding = new SforceService(); 
  // Invoke the login call and save results in LoginResult   

  LoginResult lr = binding.login("username","password"); 
  if (!lr.passwordExpired) {
  // Reset the SOAP endpoint to the returned server URL   

  binding.Url = lr.serverUrl; 
  // Create a new session header object   

  // Add the session ID returned from the login   

  binding.SessionHeaderValue = new SessionHeader(); 
  binding.SessionHeaderValue.sessionId = lr.sessionId; 
  GetUserInfoResult userInfo = lr.userInfo; 
  } else {
    Console.WriteLine("Your password is expired.");
  }

1 个答案:

答案 0 :(得分:0)

我相信您希望利用Windows Identity Foundation及其安全令牌服务/ STS模型。