1

I have created one .net desktop application to fetch some data and metadata from Salesforce. So, this application first ask for the salesforce username and password to login and once log-in is successful, it will fetch some data from the org (using Salesforce API).

Now, my customer has implemented SSO with Active Directory in his salesforce Org and he also want to implement same in .net application. So, I want to implement SSO in .net application so that user does not need to remember credentials and can be authenticated by Windows Login. Anyone have idea how I can implement this in .net Application? Any example available for implementing SSO in .net desktop application?

2

2 Answers 2

0

Use OpenID Connect or SAML. OpenID Connect (OIDC) was specifically designed for this use case but support for it in libraries/frameworks is still evolving. You'll need ASP.NET Core 1.0 (previously known as ASP.NET 5) on .NET side . With SAML, you'll have to use an embedded web browser control. While that isn't a very desktop-friendly approach, it is widely used and there are many examples out there.

OIDC
- Salesforce side: https://help.salesforce.com/articleView?id=sso_provider_openid_connect.htm&language=en_US&type=0
- .NET side: here's a good blog https://andrewlock.net/an-introduction-to-openid-connect-in-asp-net-core/

SAML:
- Salesforce side: https://help.salesforce.com/articleView?id=sso_saml.htm&type=0
- .NET side: Look at Kentor AuthServices middleware

1
  • Thanks for the answer and providing options. I will look into each approach and see which approach is suitable for my problem.
    – rakesh
    Jun 29, 2017 at 3:15
-1

Finally after so much reserch I have achieved the sso functionality using API.

  • First, I have done settings for Single Sign-on in my salesforce org.
  • set Federation Id to one of my user which I want to map to my Active Directory User.
  • Added trust relationship between my org and AD in Active Directory(IDP)
  • Used browser control in my. net org
  • programmatically navigate to Idp initiated login url.
  • Get saml response in base64 encoded form.
  • firm up specific post request using saml response and send it to salesforce token url.
  • This will give Token in response.
    That's it. This is what we want. This token can be used to access any org data using soap or rest api or http request.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .