Hi all,
 I'm having some trouble using Shiro, any help appreciated.
I've created a simple MethodInterceptor that appropriately wraps my code and tries to setup the Shiro subject & session etc. I'm in a standalone (not web) spring environment, I dont have any IPaddress information, but I do have a string I want to use as a SessionId.

I thought duplicating the code from the SecureRemoteInvocationExecutor would do it, but it doesnt.

 SecurityManager securityManager =
this.securityManager != null ? this.securityManager : SecurityUtils.getSecurityManager();

            Subject.Builder builder = new Subject.Builder(securityManager);

builder.sessionId(MySessionId);

Subject subject = builder.buildSubject();//fails here with session doesnt exist

so I found a thread that hinted at something so I tried this instead:
            SecurityManager securityManager =
this.securityManager != null ? this.securityManager : SecurityUtils.getSecurityManager();

SimpleSession session = new SimpleSession();

            session.setId(MySessionId);
            Subject subject = new
    Subject.Builder(securityManager).session(session).buildSubject();

this works, but when its called again with the same MySessionId the session is recreated here so nothing sticks.

I'd very much appreciate an example of how this is supposed to be done.
how does the principle get set etc?


thank you.
Jason.














Reply via email to