use of org.apache.logging.log4j.core.util.BasicAuthorizationProvider in project logging-log4j2 by apache.
the class ConfigurationFactory method authorizationProvider.
public static AuthorizationProvider authorizationProvider(final PropertiesUtil props) {
final String authClass = props.getStringProperty(PREFIXES, AUTHORIZATION_PROVIDER, null);
AuthorizationProvider provider = null;
if (authClass != null) {
try {
final Object obj = LoaderUtil.newInstanceOf(authClass);
if (obj instanceof AuthorizationProvider) {
provider = (AuthorizationProvider) obj;
} else {
LOGGER.warn("{} is not an AuthorizationProvider, using default", obj.getClass().getName());
}
} catch (final Exception ex) {
LOGGER.warn("Unable to create {}, using default: {}", authClass, ex.getMessage());
}
}
if (provider == null) {
provider = new BasicAuthorizationProvider(props);
}
return provider;
}
Aggregations