AuthorizerContext

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

AuthorizerContext

Mark Bean
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
Reply | Threaded
Open this post in threaded view
|

Re: AuthorizerContext

Matt Gilman
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 <[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: AuthorizerContext

Mark Bean
I neglected to make the method public. All better now. Thanks for
confirming.


On Thu, Jul 27, 2017 at 1:59 PM, Matt Gilman <[hidden email]>
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 <[hidden email]> 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
> >
>