Base solution for your next web application
Open Closed

Saml 2 support #9085


User avatar
0
PhilWynn created

Hi,

I have a requirement to add SSO SAML2 support to my Aspnet Zero application. I am running the MVC5 version.

I have decided to go with the Api provided by Sustainsys.Saml2 (formerly Kentor).

I have imported the library and set it up to run via the OWIN pipeline. This is easily done with the following line of code in StartUp:

app.UseSaml2Authentication(new Saml2AuthenticationOptions(true));

The return URL is set to AccountController.ExternalLoginCallback. I have the following code:

            // returns null
            var loginInfo = await _authenticationManager.GetExternalLoginInfoAsync();

            if (User.Identity.IsAuthenticated)
            {
                // returns valid claims
                var claims = ClaimsPrincipal.Current.Claims;
            }

What I am finding is that the authentication succeeds. I am getting a user identity and claims are coming across from the Identity Provider.

The problem is that the call to GetExternalLoginInfoAsync returns NULL, and I am therefore unable to sign the user in.

I am assuming that further work is required in plumbing the authenticated user into the pipeline. Please could you provide some assistance as to how I can proceed.

Many thanks.


3 Answer(s)