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.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    musa.demir created

    Can you check that https://entityframeworkcore.com/knowledge-base/55757059/aspnet-core-identity-getexternallogininfoasync-always-null

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    admin@SYNTAQ created

    Hi,

    Just a question about your implementation. Can you reccomend any guides on how to implement this?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can take a look at https://aspnetboilerplate.com/Pages/Documents/Zero/User-Management#external-authentication for implementing a new external authentication.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)