SOLR-17309: Enhance certificate based authentication plugin with flexible cert principal resolution #3029
+1,149
−6
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.
https://issues.apache.org/jira/browse/SOLR-17309
Description
This contribution introduces an enhancements to the Certificate Authentication (CertAuth) plugin offering more flexibility in the principal resolution.
The CertPrincipalResolver interface has been introduced to allow implementations to extract the principal information from an X.509 certificate. This flexibility enables more granular control over which part of the certificate is used for the Principal.
The provided implementing class (PathBasedCertPrincipalResolver) uses fields paths based pattern to find the right information to extract. The current supported fields/paths are: Subject DN, Issuer DN, and SANs (Subject Alternative Name).
The list of supported SAN fields is compatible with RFC 5280: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6
Backward compatibility: The default implementation (DEFAULT_PRINCIPAL_RESOLVER) extracts the whole subject DN which makes it backward compatible with the current implmentation.
Examples:
Given a cert with SAN.email=[email protected], the following configuration resolves "admin" as the request's Principal. This is done in 2 steps:
Tests
Test cases included.
TODO: Add documentation
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.