Sustainsys / Saml2

Saml2 Authentication services for ASP.NET
Other
945 stars 605 forks source link

saml2/Logout not working #1374

Closed RuudXuntos closed 1 year ago

RuudXuntos commented 1 year ago

Hey all,

Been trying many things but cant figure this one out when I try to do single logout on saml2/logout endpoint I get this exception:

An unhandled exception occurred while processing the request. ArgumentNullException: Value cannot be null. (Parameter 'properties') Sustainsys.Saml2.AspNetCore2.Saml2Handler.SignOutAsync(AuthenticationProperties properties)

not sure what I'm really missing, and cant find anything on the documentation for configuration for the logout. here is my configuration code:

` .AddSaml2("local", "local", options => { var local = Configuration.GetSection("Authentication:local");

                options.SPOptions.ModulePath = "saml2";
                options.SPOptions.EntityId = new EntityId(local["EntityId"]);
                options.SPOptions.ReturnUrl = new Uri("/Account/Login", UriKind.Relative);
                options.SignInScheme = "local";
                options.SignOutScheme = "local";
                options.IdentityProviders.Add(
                    new IdentityProvider(
                        new EntityId(local["IdPId"]), options.SPOptions)
                    {
                        AllowUnsolicitedAuthnResponse = true, // Need this for IdP initiated login
                        MetadataLocation = local["MetadataLocation"],
                        LoadMetadata = true,
                        RelayStateUsedAsReturnUrl = true,
                        SingleLogoutServiceUrl = new Uri("https://test.com/saml20/saml2/idp/SingleLogoutService.php")
                    });
            })`

Let me know if any other data is needed. I've also added the LogoutNameIdentifier and SessionIndex claims to the current user.

thx!

RuudXuntos commented 1 year ago

sorry thought i resolved it but didn't work :P

AndersAbel commented 1 year ago

To enable single logout you need a service certificate configured too.