Skip to content

Test: client revoked after registration is rejected at the token endpoint - #980

Draft
JoeShook wants to merge 1 commit into
developfrom
test/963-revoked-after-registration
Draft

JoeShook wants to merge 1 commit into
developfrom
test/963-revoked-after-registration

Conversation

@JoeShook

@JoeShook JoeShook commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

What changed

Adds _tests/UdapServer.Tests/Conformance/Basic/RevokedAfterRegistrationTests.cs (test-only, no library changes).

The tests run on UdapAuthServerPipeline with revocation checking turned on. The shared pipeline turns it off. CRLs are downloaded through the real FusionCache-backed CertificateDownloadCache, using an in-memory HttpMessageHandler that serves the current CRL and counts downloads. The test PKI (root CA, client certificate with URI SAN + CRL DP, CRLs) is built in memory with CertificateRequest / CertificateRevocationListBuilder, so it doesn't depend on the PKI generator's output.

  • ClientCredentials_Token_Rejected_After_Revocation_Once_Cached_Crl_Expires: the client registers while CRL Develop #1 (5 s nextUpdate) is published, and its token request succeeds using the cached CRL (1 download). The CA then publishes CRL Bump FluentAssertions from 6.7.0 to 6.8.0 #2 revoking the client. Once CRL Develop #1's nextUpdate passes, the next client_credentials request downloads CRL Bump FluentAssertions from 6.7.0 to 6.8.0 #2 and is rejected with invalid_client / Certificate chain validation failed (2 downloads). This covers the CRL cache expiry path. It waits about 5 s.
  • ClientCredentials_Token_Rejected_After_Revocation_When_Cached_Crl_Is_Evicted: same setup with a long-lived CRL Develop #1. After revocation the cached CRL is still used (token still issued). After ICertificateDownloadCache.RemoveCrlAsync, the very next request is rejected.

Result

The server already rejects the revoked client: UdapJwtSecretValidator re-runs TrustChainValidator (CRL included) on every token request. No server change was needed.

How it was tested

  • dotnet test _tests/Udap.PKI.Generator: 17 passed, 10 skipped
  • dotnet test _tests/UdapServer.Tests: 395 passed, 0 failed, 3 skipped (includes the 2 new tests)

Open questions

  • A revoked client keeps getting tokens until the cached CRL's nextUpdate (or the default 12 h TTL when a CRL has no nextUpdate). The test documents this behaviour. Is that window acceptable, or should there be a configurable maximum CRL cache lifetime?
  • Assertions use xUnit Assert to match the rest of UdapServer.Tests, which doesn't reference Shouldly.

Closes #963

🤖 Generated with Claude Code

…n endpoint

Registers a client_credentials client with revocation checking on and the
CRL served through the FusionCache-backed CertificateDownloadCache, then
publishes a new CRL that revokes the client certificate. Two cases:

- the cached CRL reaches its nextUpdate, the next token request downloads
  the new CRL and the client gets invalid_client;
- the cached CRL is evicted with RemoveCrlAsync, and the very next token
  request is rejected without waiting for nextUpdate.

The test PKI (root CA, client certificate, CRLs) is built in memory.

Closes #963

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JoeShook
JoeShook force-pushed the test/963-revoked-after-registration branch from 4893408 to ab45550 Compare November 22, 2026 14:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant