Hi Luke,

That's correct - if the instance is a WebDelegatingSubject, you can
obtain the request that way.  You can use Shiro's WebUtils for this:

HttpServletRequest request = WebUtils.getHttpRequest(subject);

This will return iff the subject is a WebDelegatingSubject however.
You would see a DelegatingSubject if you're not operating in the
context of a request thread.  Are you seeing DelegatingSubject even on
a request thread?

Cheers,
--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282


On Thu, Jan 16, 2014 at 3:11 AM, Luke Biddell <[email protected]> wrote:
> I'm looking for ways of getting the current request for the current subject
> in a custom implementation of a Shiro cache manager and cache.
>
> I've looked at the return of SecurityUtils.getSubject and I notice that if
> the subject is a WebDelegatingSubject, I can cast and obtain the request.
>
> However, some invocations only provide a DelegatingSubject.
>
> Is there an official way of getting hold of the request? Am I on the right
> lines?
>
> TIA
>
> Luke

Reply via email to