Search in sources :

Example 1 with AuthorizationServiceFactory

use of org.zalando.nakadi.plugin.api.authz.AuthorizationServiceFactory in project nakadi by zalando.

the class PluginsConfig method authorizationService.

@Bean
public AuthorizationService authorizationService(@Value("${nakadi.plugins.authz.factory}") final String factoryName, final SystemProperties systemProperties, final DefaultResourceLoader loader) {
    try {
        LOGGER.info("Initialize per-resource authorization service factory: " + factoryName);
        final Class<AuthorizationServiceFactory> factoryClass = (Class<AuthorizationServiceFactory>) loader.getClassLoader().loadClass(factoryName);
        final AuthorizationServiceFactory factory = factoryClass.newInstance();
        return factory.init(systemProperties);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        throw new BeanCreationException("Can't create AuthorizationService " + factoryName, e);
    }
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) AuthorizationServiceFactory(org.zalando.nakadi.plugin.api.authz.AuthorizationServiceFactory) Bean(org.springframework.context.annotation.Bean)

Aggregations

BeanCreationException (org.springframework.beans.factory.BeanCreationException)1 Bean (org.springframework.context.annotation.Bean)1 AuthorizationServiceFactory (org.zalando.nakadi.plugin.api.authz.AuthorizationServiceFactory)1