During an upgrade of net6.0 -> net.8.0 and v3.x of the NEasyAuthMiddleware has proven somewhat problematic.
We have existing automated tests (xunit) that check for scenarios involving unauthenticated clients with expectations and assertions of a 401 return from our controllers. The default behaviour of v2.*.
Changes made under #15, initiated by issue #11 now mean that auth middleware returns a redirect 302 when we verify.
Adopting a workaround similar to that under #11 resolves this issue for the moment but would it be possible for EasyAuthOptions to be extended with a "NoRedirectOnChallenge" property?
builder.Services.AddEasyAuth(
o =>
{
o.ForwardChallenge = o.ForwardSignOut = "MyEasyAuth";
})
.AddScheme<EasyAuthOptions, EasyAuthSignOutAuthenticationHandler>("MyEasyAuth", _ => { });
internal class EasyAuthNoChallengeAuthenticationHandler : AuthenticationHandler<EasyAuthOptions>
{
public EasyAuthNoChallengeAuthenticationHandler(
IOptionsMonitor<EasyAuthOptions> options,
ILoggerFactory logger,
UrlEncoder encoder) : base(options, logger, encoder) { }
protected override Task<AuthenticateResult> HandleAuthenticateAsync() => throw new NotImplementedException();
}
During an upgrade of net6.0 -> net.8.0 and v3.x of the NEasyAuthMiddleware has proven somewhat problematic.
We have existing automated tests (xunit) that check for scenarios involving unauthenticated clients with expectations and assertions of a 401 return from our controllers. The default behaviour of v2.*.
Changes made under #15, initiated by issue #11 now mean that auth middleware returns a redirect 302 when we verify.
Adopting a workaround similar to that under #11 resolves this issue for the moment but would it be possible for
EasyAuthOptionsto be extended with a "NoRedirectOnChallenge" property?