| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | |
| | | /** The DN of the configuration entry for this trust manager provider. */ |
| | | private DN configEntryDN; |
| | | |
| | |
| | | /** The trust store type to use. */ |
| | | private String trustStoreType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this file-based trust manager provider. The |
| | | * <CODE>initializeTrustManagerProvider</CODE> method must be called on the |
| | |
| | | // No implementation is required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeTrustManagerProvider( |
| | | FileBasedTrustManagerProviderCfg configuration) |
| | |
| | | configEntryDN = configuration.dn(); |
| | | configuration.addFileBasedChangeListener(this); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | | trustStoreFile = configuration.getTrustStoreFile(); |
| | | File f = getFileForPath(trustStoreFile); |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | |
| | | // Get the trust store type. If none is specified, then use the default |
| | | // type. |
| | | trustStoreType = configuration.getTrustStoreType(); |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | |
| | | // Get the PIN needed to access the contents of the trust store file. We |
| | | // will offer several places to look for the PIN, and we will do so in the |
| | | // following order: |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeTrustManagerProvider() |
| | | { |
| | | currentConfig.removeFileBasedChangeListener(this); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public TrustManager[] getTrustManagers() |
| | | throws DirectoryException |
| | |
| | | message, e); |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | String trustManagerAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | TrustManagerProviderCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | FileBasedTrustManagerProviderCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | boolean configAcceptable = true; |
| | | DN cfgEntryDN = configuration.dn(); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | | String newTrustStoreFile = configuration.getTrustStoreFile(); |
| | | try |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // Check to see if the trust store type is acceptable. |
| | | String storeType = configuration.getTrustStoreType(); |
| | | if (storeType != null) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If there is a PIN property, then make sure the corresponding |
| | | // property is set. |
| | | String pinProp = configuration.getTrustStorePinProperty(); |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // If there is a PIN environment variable, then make sure the corresponding |
| | | // environment variable is set. |
| | | String pinEnVar = configuration.getTrustStorePinEnvironmentVariable(); |
| | |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // If there is a PIN file, then make sure the file exists and is readable. |
| | | String pinFile = configuration.getTrustStorePinFile(); |
| | | if (pinFile != null) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return configAcceptable; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | FileBasedTrustManagerProviderCfg configuration) |
| | | { |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | |
| | | // Get the path to the trust store file. |
| | | String newTrustStoreFile = configuration.getTrustStoreFile(); |
| | | File f = getFileForPath(newTrustStoreFile); |
| | |
| | | ccr.setResultCode(DirectoryServer.getServerErrorResultCode()); |
| | | } |
| | | |
| | | |
| | | // Get the PIN needed to access the contents of the trust store file. We |
| | | // will offer several places to look for the PIN, and we will do so in the |
| | | // following order: |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | { |
| | | trustStoreFile = newTrustStoreFile; |