You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <e....@pocos.nl> on 2017/12/20 08:45:20 UTC

Problem finding current user using Togglz module

Hi,

I was trying to configure a Togglz feature with 
UserRoleActivationStrategy but while determining the state of the 
Feature an exception is thrown at [1]. I configured the module as 
described in the documentation. The application is running on Jetty.

Did anybody have similar problems or does anyone have experience using 
different strategies?

Thanks,
Erik


[1] 
https://github.com/incodehq/incode-platform/blob/master/modules/ext/togglz/impl/src/main/java/org/isisaddons/module/togglz/glue/service/userprovider/UserProviderUsingServletPrincipal.java#L21

Re: Problem finding current user using Togglz module

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Erik,

We don't use this ourselves, and I must admit only having a vague
recollection of this.

It looks like the HttpServletRequestHolder class you are calling is just
togglz code, rather than anything in the isisaddons togglz integration.

A quick search through the togglz docs led me to [1], from which it seems
that something somewhere needs to call bind() on this class [2], to set the
user on a thread-local.  Perhaps using HttpServletRequestHolderListener [3]
?

If you get something working, perhaps you could submit a PR to the docs to
make this clearer?

Thanks
Dan

[1] https://www.togglz.org/documentation/authentication.html
[2]
https://github.com/togglz/togglz/blob/master/servlet/src/main/java/org/togglz/servlet/util/HttpServletRequestHolder.java#L20
[3]
https://github.com/togglz/togglz/blob/master/servlet/src/main/java/org/togglz/servlet/util/HttpServletRequestHolderListener.java


On Wed, 20 Dec 2017 at 08:45 Erik de Hair <e....@pocos.nl> wrote:

> Hi,
>
> I was trying to configure a Togglz feature with
> UserRoleActivationStrategy but while determining the state of the
> Feature an exception is thrown at [1]. I configured the module as
> described in the documentation. The application is running on Jetty.
>
> Did anybody have similar problems or does anyone have experience using
> different strategies?
>
> Thanks,
> Erik
>
>
> [1]
>
> https://github.com/incodehq/incode-platform/blob/master/modules/ext/togglz/impl/src/main/java/org/isisaddons/module/togglz/glue/service/userprovider/UserProviderUsingServletPrincipal.java#L21
>