开发者

Problem while implementing HttpSessionLister with Spring-Security

开发者 https://www.devze.com 2023-04-02 20:57 出处:网络
I am using Spring/Hibernate and Spring-Security for my web-based application. Now I have a requirement where I need to perform some database query at sessionDestroy method of HtppSessionLister.

I am using Spring/Hibernate and Spring-Security for my web-based application. Now I have a requirement where I need to perform some database query at sessionDestroy method of HtppSessionLister.

Inside web.xml :

<listener>
        <listener-class>com.test.TestSessionListner</listener-class>
</listener>
<session-config>
        <session-timeout>1</session-timeout>
</session-config>

With my implementation, after session timeout (of 1 min), its calling the sessionDestroyed method and fetching the required Object of TestFacade from the ApplicationContext.

Now my problem is whenever I am calling the following method using userFacade, its not able to execute the code inside the method :

Person pers开发者_StackOverflow社区on = testFacade.findPersonByUserId(userId);

How can I identify the root cause for this?


Finally got the issue....

Inside sessionDestroyed I was calling a method :

Person person = testFacade.findPersonIdByUserId(userId);

which needs some higher permissions then anonymousUser to execute the method, and at sessionDestroyed its clearing the existing user and calling sessionDestroyed method with anonymousUser permission.

So finally I have written a code, which is calling a method using Administrator writes.

0

精彩评论

暂无评论...
验证码 换一张
取 消