Class PathBasedCertPrincipalResolver

java.lang.Object
org.apache.solr.security.cert.PathBasedCertResolverBase
org.apache.solr.security.cert.PathBasedCertPrincipalResolver
All Implemented Interfaces:
CertPrincipalResolver

public class PathBasedCertPrincipalResolver extends PathBasedCertResolverBase implements CertPrincipalResolver
Implements a CertPrincipalResolver that resolves a Principal from an X509 certificate based on configurable paths, filters, and optional extraction patterns. This resolver can extract principal information from various certificate fields, such as Subject DN or SAN fields, according to the specified path. Additionally, it can further refine the extracted value based on optional "after" and "before" patterns, allowing for more precise control over the principal value.

Example configuration without extraction pattern:


 "principalResolver": {
   "class":"solr.PathBasedCertPrincipalResolver",
   "params": {
     "path":"SAN.email",
     "filter":{
       "checkType":"startsWith",
       "values":["user@example"]
     }
   }
 }
 
In this configuration, the resolver is directed to extract email addresses from the SAN (Subject Alternative Name) field of the certificate and use them as principal names if they match the specified filter criteria.

Example configuration with extraction pattern:


 "principalResolver": {
   "class":"solr.PathBasedCertPrincipalResolver",
   "params": {
     "path":"SAN.email",
     "filter":{
       "checkType":"startsWith",
       "values":["email_user1@example"]
     },
     "extract": {
       "after":"_",
       "before":"@"
     }
   }
 }
 
In this extended configuration, after extracting email addresses that match the filter criteria, the resolver further processes the extracted value to include only the portion after the "_" symbol and before "@". This allows for extracting specific parts of the principal value, providing additional flexibility and control.
  • Constructor Details

    • PathBasedCertPrincipalResolver

      public PathBasedCertPrincipalResolver(Map<String,Object> params)
      Constructs a new PathBasedCertPrincipalResolver with the specified configuration parameters.
      Parameters:
      params - The configuration parameters specifying the path and filter for extracting principal information from certificates.
  • Method Details