Send your shiro config please
On 18 Mar 2014 20:53, "onelazyguy" <[email protected]> wrote:

> Class A, I create a session using Shiro:
>
> Subject currentUser = null;
> currentUser = SecurityUtils.getSubject();
> Session session = currentUser.getSession(true);
> session.setAttribute("currentUser", username);
>
> Class B is a restful service. I have a restful web service method that is
> trying to get the username session that was set in Class A:
>
> HttpSession session = request.getSession();
> String currentUser = (String) session.getAttribute("currentUser");
> logger.debug("currently logged in user is: " + currentUser);
>
> logger shows currentUser as null
>
> Question: How to get the currentUser session from my code? It is showing as
> null. I am novice with Shiro. Can someone help? What I am trying to do is
> to
> log in the user and create a session and before any service is consumed by
> that user. I need to see if that user has the permission to consume that
> service or not. I am using @Context HttpServletRequest request from my
> restful service class.
>
> I have read about shiro DefaultWebSessionManager from shiro's site tutorial
> but cannot understand it. Can someone give me an example of how I can
> achieve this?
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/How-to-get-the-user-session-using-apache-shiro-with-jersey-RESTful-tp7579771.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Reply via email to