We have an asp.net website built in MVC framework. We want to make our website a SAML2 provider as mentioned in the Readme of this project. What all we need make changes in the controller to get this working ? (We have updated the web.config but could not get it working yet. ) Is there a step by step guide or something ?
Our end goal is to use Cognito Federated Identity and add our website as the SAML2 provider. This will help our mobile apps to use our existing users to login into the mobile apps.
When I set up Sustainsys.Saml2 with an MVC application, I also had to add routes for the Saml2 library endpoints to my Global.asax.cs.
routes.MapRoute("AuthIndex", "Saml2", new { controller = "Saml2", action = "Index" });
routes.MapRoute("AuthAcs", "Saml2/Acs", new { controller = "Saml2", action = "Acs" });
routes.MapRoute("SignIn", "Saml2/SignIn", new { controller = "Saml2", action = "SignIn" });
routes.MapRoute("Logout", "Saml2/Logout", new { controller = "Saml2", action = "Logout" });
Then the metadata file will be generated at yourdomain.com/apppath/Saml2. The link to log in would be yourdomain.com/apppath/Saml2/SignIn, etc.
Here's an example config that I use to connect to an ADFS identity provider.
```
Thanks for the response. We are not using ACtive directory in our application but normal form authentication with a Provider we created. We have the username and passwords stored in our SQL database. And this we want to use in Cognito , instead of creating new users in Cognito
Hey @ychhajed, I am in fact implementing an SSO into an MVC application. I've been able to use your example above and it's helped me moved forward. The part I'm still having trouble with is the certificate part. I've been provided with a .cer file, which I've installed. Is that the certificate I reference in the serviceCertificates portion of the web config? Or is it under the signing certificate?
@ychhajed I could be misinterpreting, but it sounds like you're trying to roll your own _identity provider_. This library is for providing _service provider_ functionality for an app.
@smcnaryM3 Yes, the certificate referenced in the serviceCertificates section is the one that your app (the service provider) will use to sign SAML assertions. Typically it needs to be in the Personal store of the Local Computer. The user or group your application runs under/as will need read access to the private key for the certificate (in the Certificates console, if you right click on the certificate, this is under All Tasks > Manage Private Keys). You may also need to update your application pool to set Load User Profile to true.
Looks like this is solved, closing.