You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Mark Bean <ma...@gmail.com> on 2017/07/27 17:51:50 UTC

AuthorizerContext

I am writing a custom authorizer, and I need access to some properties in
nifi.properties during the onConfigured method. It is similar to the usage
in FileAccessPolicyProvider. In this class, there is a setNiFiProperties
method annotated with @AuthorizerContext. Presumably, this annotation
causes the framework to execute the method. When does this occur? More
specifically, does it occur before the onConfigured method is invoked?

In my testing, setNiFiProperties is not being called - at least not prior
to onConfigured in which case an NPE is thrown due to the properties not
being set.

Thanks,
Mark

Re: AuthorizerContext

Posted by Mark Bean <ma...@gmail.com>.
I neglected to make the method public. All better now. Thanks for
confirming.


On Thu, Jul 27, 2017 at 1:59 PM, Matt Gilman <ma...@gmail.com>
wrote:

> Yes. The setter is invoked prior to initialize(...) and onConfigured(...)
> [1]. Can you debug and see where it's failing?
>
> Matt
>
> [1] https://github.com/apache/nifi/blob/master/nifi-nar-
> bundles/nifi-framework-bundle/nifi-framework/nifi-
> authorizer/src/main/java/org/apache/nifi/authorization/
> AuthorizerFactoryBean.java#L311
>
> On Thu, Jul 27, 2017 at 1:51 PM, Mark Bean <ma...@gmail.com> wrote:
>
> > I am writing a custom authorizer, and I need access to some properties in
> > nifi.properties during the onConfigured method. It is similar to the
> usage
> > in FileAccessPolicyProvider. In this class, there is a setNiFiProperties
> > method annotated with @AuthorizerContext. Presumably, this annotation
> > causes the framework to execute the method. When does this occur? More
> > specifically, does it occur before the onConfigured method is invoked?
> >
> > In my testing, setNiFiProperties is not being called - at least not prior
> > to onConfigured in which case an NPE is thrown due to the properties not
> > being set.
> >
> > Thanks,
> > Mark
> >
>

Re: AuthorizerContext

Posted by Matt Gilman <ma...@gmail.com>.
Yes. The setter is invoked prior to initialize(...) and onConfigured(...)
[1]. Can you debug and see where it's failing?

Matt

[1] https://github.com/apache/nifi/blob/master/nifi-nar-
bundles/nifi-framework-bundle/nifi-framework/nifi-
authorizer/src/main/java/org/apache/nifi/authorization/
AuthorizerFactoryBean.java#L311

On Thu, Jul 27, 2017 at 1:51 PM, Mark Bean <ma...@gmail.com> wrote:

> I am writing a custom authorizer, and I need access to some properties in
> nifi.properties during the onConfigured method. It is similar to the usage
> in FileAccessPolicyProvider. In this class, there is a setNiFiProperties
> method annotated with @AuthorizerContext. Presumably, this annotation
> causes the framework to execute the method. When does this occur? More
> specifically, does it occur before the onConfigured method is invoked?
>
> In my testing, setNiFiProperties is not being called - at least not prior
> to onConfigured in which case an NPE is thrown due to the properties not
> being set.
>
> Thanks,
> Mark
>