WsFederation authneitcaton in .net 8

Matt 0 Reputation points
2024-07-19T11:17:20.0033333+00:00

We were using .Net 7 WSFederation successfully. We have now moved to .Net 8 and the authentication has stopped working. Can anybody advise what has changed?

We are using WsFederation 8.0.7 and Microsoft.IdentityModel.Tokene 8.0.0.

Our code is :-

public static IServiceCollection AddWsFederationAuthentication(this IServiceCollection services, ConfigurationManager configuration)

    {

         services.AddAuthentication(options =>

        {

            options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;

            options.DefaultChallengeScheme = WsFederationDefaults.AuthenticationScheme;

        })

         .AddCookie() 

            .AddWsFederation(options =>

            {

                options.Wtrealm = "www.host.com";

                options.MetadataAddress = "https://microosftOnline etc";

                 options.Events = new WsFederationEvents

                {

                    OnAuthenticationFailed = context =>

                    {

                        // Handle authentication failure

                        context.Response.Redirect("/Host/error");

                        return Task.CompletedTask;

                    }

                };

            });

            

        return services;

    }

We get an error stating Microsoft.IdentityModel.Tokens.SecurityTokenException: No token validator or token handler was found for the given token

---> System.AggregateException: One or more errors occurred. (IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.) (IDX30011: Unable to read XML

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,611 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Matt 0 Reputation points
    2024-07-22T07:05:11.0433333+00:00

    We use SAML and I am using the latest version System.IdentityModel.Token 8.0.0

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.