fix: session B — Go-faithful auth error states, NKey padding, permissions, signal disposal

This commit is contained in:
Joseph Doherty
2026-02-26 17:49:13 -05:00
parent 8c380e7ca6
commit a0c9c0094c
12 changed files with 97 additions and 46 deletions

View File

@@ -27,23 +27,30 @@ public class AuthHandlerExtendedTests
}
[Fact]
public void GetAuthErrClosedState_ExpiredMessage_ReturnsExpiredState()
public void GetAuthErrClosedState_ProxyNotTrusted_ReturnsProxyNotTrusted()
{
var err = new InvalidOperationException("token is expired");
AuthHandler.GetAuthErrClosedState(err).ShouldBe(ClosedState.AuthenticationExpired);
var err = new AuthProxyNotTrustedException();
AuthHandler.GetAuthErrClosedState(err).ShouldBe(ClosedState.ProxyNotTrusted);
}
[Fact]
public void GetAuthErrClosedState_NullError_ReturnsTimeout()
public void GetAuthErrClosedState_ProxyRequired_ReturnsProxyRequired()
{
AuthHandler.GetAuthErrClosedState(null).ShouldBe(ClosedState.AuthenticationTimeout);
var err = new AuthProxyRequiredException();
AuthHandler.GetAuthErrClosedState(err).ShouldBe(ClosedState.ProxyRequired);
}
[Fact]
public void GetAuthErrClosedState_RevokedMessage_ReturnsRevoked()
public void GetAuthErrClosedState_OtherError_ReturnsAuthenticationViolation()
{
var err = new InvalidOperationException("credential was revoked");
AuthHandler.GetAuthErrClosedState(err).ShouldBe(ClosedState.AuthRevoked);
var err = new InvalidOperationException("bad credentials");
AuthHandler.GetAuthErrClosedState(err).ShouldBe(ClosedState.AuthenticationViolation);
}
[Fact]
public void GetAuthErrClosedState_NullError_ReturnsAuthenticationViolation()
{
AuthHandler.GetAuthErrClosedState(null).ShouldBe(ClosedState.AuthenticationViolation);
}
[Fact]

View File

@@ -40,7 +40,7 @@ public class JwtProcessorTests
public void WipeSlice_FillsWithX()
{
var buf = new byte[] { 0x01, 0x02, 0x03 };
JwtProcessor.WipeSlice(buf);
AuthHandler.WipeSlice(buf);
buf.ShouldAllBe(b => b == (byte)'x');
}
@@ -48,7 +48,7 @@ public class JwtProcessorTests
public void WipeSlice_EmptyBuffer_NoOp()
{
var buf = Array.Empty<byte>();
JwtProcessor.WipeSlice(buf);
AuthHandler.WipeSlice(buf);
}
// =========================================================================