| | |
| | | /** The set of attributes to return in search result entries. */ |
| | | private LinkedHashSet<String> requestedAttributes; |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this certificate mapper. Note that all actual |
| | | * initialization should be done in the |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeCertificateMapper( |
| | | FingerprintCertificateMapperCfg configuration) |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | // Make sure that the fingerprint attribute is configured for equality in |
| | | // all appropriate backends. |
| | | Set<DN> cfgBaseDNs = configuration.getUserBaseDN(); |
| | |
| | | requestedAttributes = newLinkedHashSet("*", "+"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeCertificateMapper() |
| | | { |
| | | currentConfig.removeFingerprintChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry mapCertificateToUser(Certificate[] certificateChain) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the first certificate in the chain. It must be an X.509 certificate. |
| | | X509Certificate peerCertificate; |
| | | try |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Get the signature from the peer certificate and create a digest of it |
| | | // using the configured algorithm. |
| | | String fingerprintString; |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message); |
| | | } |
| | | |
| | | |
| | | // Create the search filter from the fingerprint. |
| | | ByteString value = ByteString.valueOfUtf8(fingerprintString); |
| | | SearchFilter filter = |
| | | SearchFilter.createEqualityFilter(fingerprintAttributeType, value); |
| | | |
| | | |
| | | // If we have an explicit set of base DNs, then use it. Otherwise, use the |
| | | // set of public naming contexts in the server. |
| | | Collection<DN> baseDNs = config.getUserBaseDN(); |
| | |
| | | baseDNs = DirectoryServer.getPublicNamingContexts().keySet(); |
| | | } |
| | | |
| | | |
| | | // For each base DN, issue an internal search in an attempt to map the |
| | | // certificate. |
| | | Entry userEntry = null; |
| | |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_CREDENTIALS, message); |
| | | |
| | | |
| | | case TIME_LIMIT_EXCEEDED: |
| | | case ADMIN_LIMIT_EXCEEDED: |
| | | // The search criteria was too inefficient. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If we've gotten here, then we either found exactly one user entry or we |
| | | // didn't find any. Either way, return the entry or null to the caller. |
| | | return userEntry; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(CertificateMapperCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | FingerprintCertificateMapperCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FingerprintCertificateMapperCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the algorithm that will be used to generate the fingerprint. |
| | | String newFingerprintAlgorithm = null; |
| | | switch (configuration.getFingerprintAlgorithm()) |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | fingerprintAlgorithm = newFingerprintAlgorithm; |