Search in sources :

Example 1 with Provider

use of org.apache.nifi.registry.security.authentication.generated.Provider in project nifi-registry by apache.

the class IdentityProviderFactory method getIdentityProvider.

@Bean
@Primary
public IdentityProvider getIdentityProvider() throws Exception {
    if (identityProvider == null) {
        // look up the login identity provider to use
        final String loginIdentityProviderIdentifier = properties.getProperty(NiFiRegistryProperties.SECURITY_IDENTITY_PROVIDER);
        // ensure the login identity provider class name was specified
        if (StringUtils.isNotBlank(loginIdentityProviderIdentifier)) {
            final IdentityProviders loginIdentityProviderConfiguration = loadLoginIdentityProvidersConfiguration();
            // create each login identity provider
            for (final Provider provider : loginIdentityProviderConfiguration.getProvider()) {
                identityProviders.put(provider.getIdentifier(), createLoginIdentityProvider(provider.getIdentifier(), provider.getClazz()));
            }
            // configure each login identity provider
            for (final Provider provider : loginIdentityProviderConfiguration.getProvider()) {
                final IdentityProvider instance = identityProviders.get(provider.getIdentifier());
                instance.onConfigured(loadLoginIdentityProviderConfiguration(provider));
            }
            // get the login identity provider instance
            identityProvider = getIdentityProvider(loginIdentityProviderIdentifier);
            // ensure it was found
            if (identityProvider == null) {
                throw new Exception(String.format("The specified login identity provider '%s' could not be found.", loginIdentityProviderIdentifier));
            }
        }
    }
    return identityProvider;
}
Also used : IdentityProviders(org.apache.nifi.registry.security.authentication.generated.IdentityProviders) SensitivePropertyProtectionException(org.apache.nifi.registry.properties.SensitivePropertyProtectionException) JAXBException(javax.xml.bind.JAXBException) InvocationTargetException(java.lang.reflect.InvocationTargetException) SAXException(org.xml.sax.SAXException) SensitivePropertyProvider(org.apache.nifi.registry.properties.SensitivePropertyProvider) Provider(org.apache.nifi.registry.security.authentication.generated.Provider) Primary(org.springframework.context.annotation.Primary) DisposableBean(org.springframework.beans.factory.DisposableBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 JAXBException (javax.xml.bind.JAXBException)1 SensitivePropertyProtectionException (org.apache.nifi.registry.properties.SensitivePropertyProtectionException)1 SensitivePropertyProvider (org.apache.nifi.registry.properties.SensitivePropertyProvider)1 IdentityProviders (org.apache.nifi.registry.security.authentication.generated.IdentityProviders)1 Provider (org.apache.nifi.registry.security.authentication.generated.Provider)1 DisposableBean (org.springframework.beans.factory.DisposableBean)1 Bean (org.springframework.context.annotation.Bean)1 Primary (org.springframework.context.annotation.Primary)1 SAXException (org.xml.sax.SAXException)1