I'm not sure I'm fully following anymore, lets take a step back, tell us
about your stack. And we can point you in the right direction. (there are a
few ways to process the Shiro annotations, Spring, Guice, JAX-RS, aop, (and
CDI on a branch).

Take a look at this as well:
https://shiro.apache.org/subject.html#thread-association

On Wed, Jan 25, 2017 at 10:47 PM, yoann159 <[email protected]>
wrote:

> Hi,
>
>
>
> I tried the aspect example ( <https://github.com/apache/
> shiro/tree/master/samples/aspectj/src/main/java/org/
> apache/shiro/samples/aspectj/bank> https://github.com/apache/
> shiro/tree/master/samples/aspectj/src/main/java/org/
> apache/shiro/samples/aspectj/bank)
>
> It works for the tests but I do not see how I can intercept the
> RequiresPermissions or RequiresRoles or etc to get the jointpoint called,
> get the reference of subject stored in the service instantiated for that
> client and simply call set method to set Subject to current executing
> thread.
>
>
>
> Also  <https://github.com/apache/shiro/blob/master/samples/spring-boot/>
> https://github.com/apache/shiro/blob/master/samples/spring-boot/ is good
> simple example but like I said I do not use Spring context, I do desktop
> app with a server and clients.
>
>
>
>
>
> Unless it is possible to use Spring without a web context? Spring boot is
> good but it is more like: @GetMapping() @RequestMapping(…)
>
>
>
> I maybe have a solution with:
> pointcut allow(): 
> execution(@org.apache.shiro.authz.annotation.RequiresPermissions
> * *(..)) || execution(@org.apache.shiro.authz.annotation.RequiresRoles *
> *(..));
>
> With that I can have before advice and do:
>
>
>
> ((Service) thisJoinPoint.getThis()).getSubject();
> ThreadState threadState = new SubjectThreadState(subject);
> threadState.bind();
>
>
>
> Not sure if I need to add a after advice to unbind the threadState but it
> seems to work, and anyway any method will override the current subject.
> What would you suggest?
>
>
>
> Thank you.
>
>
>
> From: Brian Demers [via Shiro User] [mailto:ml-node+
> [email protected]]
> Sent: 2017年1月25日 22:32
> To: yoann159
> Subject: Re: How to make RMI work with Apache Shiro
>
>
>
> Take a look at: https://shiro.apache.org/spring.html#secure-spring-
> remoting
>
>
>
> Most of the Spring samples also include a remoting example:Â
> https://github.com/apache/shiro/tree/master/samples
>
>
>
> There is also an aspectj example
>
>
>
> On Tue, Jan 24, 2017 at 11:24 PM, yoann159 <[hidden email]> wrote:
>
> How to make RMI work with Apache Shiro?
>
> Each calls on a method with @RequireRoles("..") execute on different thread
> shared by multiple clients.
>
> Is there a way to intercept this AOP, set the current Subject for this
> thread (threadLocal), then unset it at the end of the method?
>
> Thank you for your help
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.
> nabble.com/How-to-make-RMI-work-with-Apache-Shiro-tp7581467.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>
>
>
>
>
>   _____
>
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://shiro-user.582556.n2.nabble.com/How-to-make-RMI-
> work-with-Apache-Shiro-tp7581467p7581468.html
>
> To unsubscribe from How to make RMI work with Apache Shiro, click here <
> http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=
> unsubscribe_by_code&node=7581467&code=eW9hbm5Ac2Fhcy5hbGx1cmVzeXN0ZW
> 1zLmNvbXw3NTgxNDY3fDYzMDk5NjIyOQ==> .
>  <http://shiro-user.582556.n2.nabble.com/template/
> NamlServlet.jtp?macro=macro_viewer&id=instant_html%
> 21nabble%3Aemail.naml&base=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace&breadcrumbs=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML
>
>
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.
> nabble.com/How-to-make-RMI-work-with-Apache-Shiro-tp7581467p7581473.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Reply via email to