Invalid configuration: authentication.ps1

I can’t seem to get this error to go away in my environment. It’s always been a problem for this error to pop up but ADFS is working as expected in my environment so I’m not really sure what could be causing this problem.

My log file consistently keeps throwing this error as well.

2022-10-05 06:59:53.832 -07:00 [ERR] Connection id "0HML6R7CVVFC3", Request id "0HML6R7CVVFC3:00000002": An unhandled exception was thrown by the application.
System.InvalidOperationException: No authentication handler is registered for the scheme 'WsFederation'. The registered schemes are: Identity.External, Cookies, Bearer. Did you forget to call AddAuthentication().Add[SomeAuthHandler]("WsFederation",...)?
   at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
   at Microsoft.AspNetCore.Authorization.Policy.PolicyEvaluator.AuthenticateAsync(AuthorizationPolicy policy, HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at PowerShellUniversal.DisallowedModeMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\ModeMiddleware.cs:line 46
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 155
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Universal.Server.Middleware.SwaggerAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Middleware\SwaggerAuthMiddleware.cs:line 40
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at AspNetCoreRateLimit.RateLimitMiddleware`1.Invoke(HttpContext context) in C:\actions-runner\_work\universal\universal\src\AspNetCoreRateLimit\Middleware\RateLimitMiddleware.cs:line 109
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2022-10-05 06:59:53.836 -07:00 [ERR] Failed to read configuration file. authentication.ps1
System.Management.Automation.ParameterBindingException: Cannot process command because of one or more missing mandatory parameters: Wreply.
   at UniversalAutomation.PowerShellSerializer`1.Deserialize(String script, IDatabase database, IConfigurationService configService) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\PowerShellSerializer.cs:line 45
   at UniversalAutomation.Services.ConfigurationScript`1.ReadAsync(Boolean initialSync) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal\ConfigurationScript.cs:line 0

Here’s my configuration. I’m not sure what I’m supposed to put for my wreply field so I’ve left it blank. I did find that other thread where it says it’s mistakenly required so is that the source of my issues?

"WSFed": {
      "Enabled": "true",
      "MetadataAddress": "https://ADFS.Server.Local/FederationMetadata/2007-06/FederationMetadata.xml",
      "Wtrealm": "https://Univeral.Server.Local",
      "CallbackPath": "/auth/signin-wsfed",
	"wreply": "",
      "UseTokenLifetime": true,
      "CorrelationCookieSameSite": ""
    }
Product: PowerShell Universal
Version: 3.3.6

If you have configured WSFed in your appsettings.json file, you shouldn’t need to configure it in authentication.ps1. I would just comment out the Set-PSUAuthentication call in authentication.ps1 to see if your authentication continues to work and the error is no longer shown.

That did it! Thanks Adam for the quick response!