Search in sources :

Example 1 with SensitivePropertyProtectionException

use of org.apache.nifi.properties.SensitivePropertyProtectionException in project nifi by apache.

the class LoginIdentityProviderFactoryBean method initializeSensitivePropertyProvider.

private static void initializeSensitivePropertyProvider(String encryptionScheme) throws SensitivePropertyProtectionException {
    if (SENSITIVE_PROPERTY_PROVIDER == null || !SENSITIVE_PROPERTY_PROVIDER.getIdentifierKey().equalsIgnoreCase(encryptionScheme)) {
        try {
            String keyHex = getMasterKey();
            SENSITIVE_PROPERTY_PROVIDER_FACTORY = new AESSensitivePropertyProviderFactory(keyHex);
            SENSITIVE_PROPERTY_PROVIDER = SENSITIVE_PROPERTY_PROVIDER_FACTORY.getProvider();
        } catch (IOException e) {
            logger.error("Error extracting master key from bootstrap.conf for login identity provider decryption", e);
            throw new SensitivePropertyProtectionException("Could not read master key from bootstrap.conf");
        }
    }
}
Also used : AESSensitivePropertyProviderFactory(org.apache.nifi.properties.AESSensitivePropertyProviderFactory) SensitivePropertyProtectionException(org.apache.nifi.properties.SensitivePropertyProtectionException) IOException(java.io.IOException)

Example 2 with SensitivePropertyProtectionException

use of org.apache.nifi.properties.SensitivePropertyProtectionException in project nifi by apache.

the class AuthorizerFactoryBean method initializeSensitivePropertyProvider.

private static void initializeSensitivePropertyProvider(String encryptionScheme) throws SensitivePropertyProtectionException {
    if (SENSITIVE_PROPERTY_PROVIDER == null || !SENSITIVE_PROPERTY_PROVIDER.getIdentifierKey().equalsIgnoreCase(encryptionScheme)) {
        try {
            String keyHex = getMasterKey();
            SENSITIVE_PROPERTY_PROVIDER_FACTORY = new AESSensitivePropertyProviderFactory(keyHex);
            SENSITIVE_PROPERTY_PROVIDER = SENSITIVE_PROPERTY_PROVIDER_FACTORY.getProvider();
        } catch (IOException e) {
            logger.error("Error extracting master key from bootstrap.conf for login identity provider decryption", e);
            throw new SensitivePropertyProtectionException("Could not read master key from bootstrap.conf");
        }
    }
}
Also used : AESSensitivePropertyProviderFactory(org.apache.nifi.properties.AESSensitivePropertyProviderFactory) SensitivePropertyProtectionException(org.apache.nifi.properties.SensitivePropertyProtectionException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 AESSensitivePropertyProviderFactory (org.apache.nifi.properties.AESSensitivePropertyProviderFactory)2 SensitivePropertyProtectionException (org.apache.nifi.properties.SensitivePropertyProtectionException)2