public class AuthorizerInstantiator extends Object implements Closeable, com.google.common.base.Supplier<Authorizer>
Authorizer extensions. Authorization extensions are instantiated using a
separate ClassLoader that is built using a bundled jar for the Authorizer extension that
contains all its required dependencies. The ClassLoader is created with the parent as the classloader with
which the Authorizer interface is instantiated. This parent only has classes required by the
cdap-security-spi module.
The AuthorizerInstantiator has the following expectations from the extension:
Constants.Security.Authorization#ENABLED to true in
cdap-site.xml. When authorization is disabled, an instance of NoOpAuthorizer is returned.Constants.Security.Authorization#EXTENSION_JAR_PATH in cdap-site.xmlAttributes.Name#MAIN_CLASS
attribute in the extension jar's manifest file. This class must implement Authorizer and have a default
constructor.get(), the instantiator creates an instance of the Authorizer
class and also calls its Authorizer.initialize(AuthorizationContext) method with an
AuthorizationContext created using a AuthorizationContextFactory by providing it a
Properties object that is populated with all configuration settings from cdap-site.xml that have
keys with the prefix Constants.Security.Authorization#EXTENSION_CONFIG_PREFIX.close(), the Authorizer.destroy() method is invoked, and the
AuthorizerClassLoader is closed.| Constructor and Description |
|---|
AuthorizerInstantiator(CConfiguration cConf,
AuthorizationContextFactory authorizationContextFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Authorizer |
get()
Returns an instance of the configured
Authorizer extension, or of NoOpAuthorizer, if
authorization is disabled. |
@Inject public AuthorizerInstantiator(CConfiguration cConf, AuthorizationContextFactory authorizationContextFactory)
public Authorizer get()
Authorizer extension, or of NoOpAuthorizer, if
authorization is disabled.get in interface com.google.common.base.Supplier<Authorizer>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2017 Cask Data, Inc. Licensed under the Apache License, Version 2.0.