Repository navigation
Conversation
DirectTrust Certificate Profiles v2.1 (Worksheet 4-4, TEFCA RCE (UDAP), and its validation profile) require the subject organizationalUnitName RCE-FHIR on production TEFCA FHIR certificates and RCE-FHIR-TEST on validation certificates. The OU binds a certificate to TEFCA Facilitated FHIR; the same CAs issue other certificates under the same anchors. Opt-in, off by default: - TefcaValidationOptions.RequiredCertificateOrganizationalUnits, keyed by community name. When a community has an entry, x5c[0] must carry one of the listed OUs: the software statement at registration (unapproved_software_statement) and the client assertion at the token endpoint (invalid_client). - DiscoveryPolicy.RequiredSigningCertificateOrganizationalUnits applies the same check to the server metadata signing certificate in Udap.Client discovery. - TefcaConstants.OrganizationalUnits.Production / .Validation. - X509Extensions.GetSubjectOrganizationalUnits / HasSubjectOrganizationalUnit (any of several OUs may match; caseIgnoreMatch per X.520). Tests use certificates built in-test, since the generated PKI does not carry these OUs. Closes #958 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One UdapClient can discover servers in several trust communities and keeps the last policy it was given, so a single OU set would carry a TEFCA requirement over to non-TEFCA discoveries. DiscoveryPolicy.RequiredSigningCertificateOrganizationalUnits is now a dictionary of community to accepted OUs, mirroring the server option. The check runs only when the community passed to ValidateResource has a non-empty entry; other communities, or no community, are not checked. Adds DiscoveryPolicy.GetRequiredSigningCertificateOrganizationalUnits. The Udap.Tefca.Server README notes that an OU entry for a community not in Communities is ignored, and shows the client-side usage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JoeShook
force-pushed
the
tefca/958-ou-binding
branch
from
November 22, 2026 14:28
0b6a950 to
b863c4d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Opt-in subject OU policy binding for TEFCA certificates (DirectTrust Certificate Profiles v2.1, Worksheet 4-4 TEFCA RCE (UDAP) and its validation profile:
RCE-FHIRfor production,RCE-FHIR-TESTfor validation). It is off by default, so current behaviour does not change.TefcaValidationOptions.RequiredCertificateOrganizationalUnits(Dictionary<string, HashSet<string>>, keyed by community name). When a community has a non-empty entry,x5c[0]must carry at least one of the listed subject OUs:x5c[0](context.ClientCertificate). If it fails:unapproved_software_statementx5c[0]. If it fails:invalid_clientDiscoveryPolicy.RequiredSigningCertificateOrganizationalUnits(IDictionary<string, ICollection<string>>, keyed by community, mirroring the server option) withDiscoveryPolicy.GetRequiredSigningCertificateOrganizationalUnits(community), plus a virtualUdapClientDiscoveryValidator.ValidateSigningCertificateOrganizationalUnit(...).ValidateResourcechecks the server metadata signing certificate after trust chain validation, only when thecommunityargument has a non-empty entry. Other communities and discoveries with no community are not checked, so one client can use the same policy for TEFCA and non-TEFCA servers (the client keeps the last policy it was given). If it fails, discovery returns an error ("Failed Signing Certificate Organizational Unit Validation").TefcaConstants.OrganizationalUnits.Production/.Validation.X509Extensions.GetSubjectOrganizationalUnits()/HasSubjectOrganizationalUnit(...). These read every OU, including OUs inside multi-valued RDNs, through BouncyCastleX509Name. One match is enough. The comparison ignores case, following the X.520 caseIgnoreMatch rule for organizationalUnitName.Communitiesis ignored.All public API changes are additive.
How it was tested
The tests use certificates built in-test with
CertificateRequest, because the generated test PKI does not carry these OUs.UdapServer.TestsTefcaOrganizationalUnitPolicyTests(21 new tests), covering registration and token:x5cor the certificate is missingUdap.Common.TestsSigningCertificateOrganizationalUnitTests(14 new tests): validator-level matrix plus end-to-endUdapClient.ValidateResource(trust chain stubbed). One test uses the same client and policy: TEFCA discovery enforces the OU, while a different community (and no community) passes with a certificate that lacks it. Run on both net8.0 and net10.0.dotnet test _tests/UdapServer.Tests --filter Validators.Tefcagave 74/74 passed.Udap.Common.TestsClient namespace (net10.0) gave 158/158 passed.Open questions
unapproved_software_statementat registration andinvalid_clientat the token endpoint, treating a certificate that fails the policy as a client authentication failure. The other TEFCA token rules useinvalid_grant, so say if you'd rather be consistent with them.Assertto match the existing TEFCA validator tests. Shouldly isn't referenced in this repo yet.Closes #958
🤖 Generated with Claude Code