Skip to content

feat: add allowlisting to subject certificate policies and collect known Estonian production policies - #142

Open
svenzik wants to merge 1 commit into
v4from
WE2-1308
Open

svenzik wants to merge 1 commit into
v4from
WE2-1308

Conversation

@svenzik

@svenzik svenzik commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

feat: add allowlisting to subject certificate policies and collect known Estonian production policies

Signed-off-by: Sven Mitt svenzik@users.noreply.github.com

@svenzik
svenzik changed the base branch from main to v4 October 14, 2026 17:31
}

public Collection<ASN1ObjectIdentifier> getAllowedSubjectCertificatePolicies() {
return allowedSubjectCertificatePolicies;
subjectCertificatePolicyValidator = new SubjectCertificatePolicyValidator(configuration.getDisallowedSubjectCertificatePolicies());
subjectCertificatePolicyValidator = new SubjectCertificatePolicyValidator(
this.configuration.getAllowedSubjectCertificatePolicies(),
this.configuration.getDisallowedSubjectCertificatePolicies()
@mrts mrts changed the title feat: add whitelisting to subject certificate policies and collect known Estonian production policies feat: add allowlisting to subject certificate policies and collect known Estonian production policies Oct 16, 2026
@svenzik
svenzik force-pushed the WE2-1308 branch 3 times, most recently from d88babe to 4acbc6d Compare October 20, 2026 05:47
@svenzik
svenzik force-pushed the WE2-1308 branch 3 times, most recently from c4b2263 to b9ca483 Compare November 2, 2026 11:57
…onian production policies as default, add to example test card policies

WE2-1308

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

Comment thread README.md Resolved
Comment thread README.md
Use `withDisallowedCertificatePolicies(ASN1ObjectIdentifier... policies)` to add disallowed certificate policies. Estonian Mobile-ID policies are disallowed by default because smart-card authentication must not accept Mobile-ID certificates.
Certificate policy allow-lists are selected by the subject certificate's exact issuer `X500Principal`. At build time, production Estonian identity-document policies from `ESTEID_PRODUCTION_DOCUMENT_POLICIES` are used when the configured allow-list is empty. When one or more issuer entries are configured, only those entries are used. A matching issuer must contain one of its configured policy OIDs; other issuers fall back to the deprecated deny-list, which is empty by default. Calling `withAllowedCertificatePolicies(issuer)` without policy OIDs removes that issuer's entry. If no entries remain, the Estonian defaults are used.

Use `withAllowedCertificatePolicies(X500Principal issuer, ASN1ObjectIdentifier... policies)` to define a custom allow-list. Repeated calls configure all supported issuers on the same validator. The following example explicitly configures both Estonian ID-card generations in one builder chain.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add example where only Identity card of Estonian citizens is allowed or only Zetes CA is allowed.

final Collection<ASN1ObjectIdentifier> issuerAllowedPolicies = allowedSubjectCertificatePolicies.getOrDefault(issuer, Set.of());

if (extensionValue == null) {
if (!issuerAllowedPolicies.isEmpty()) {

@mrts mrts Nov 6, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either allowlist or denylist should be allowed, but not both.

configuration.validate();
return new AuthTokenValidatorImpl(configuration);
final AuthTokenValidationConfiguration configurationSnapshot = configuration.copy();
if (configurationSnapshot.getAllowedSubjectCertificatePolicies().isEmpty()) {

@mrts mrts Nov 6, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either allowlist or denylist should be allowed, but not both.

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.

3 participants