Java – listen for login events in JBoss as 6

I have an application running in JBoss as6 Authentication is using the 'form' authentication method and the user is logging in correctly

I want to be able to call a custom static code when the user logs in successfully

Unfortunately, I couldn't find any listeners, hooks or callbacks that would execute code on successful login HttpSessionListener does have a "sessioncreated" event, but it will be called once users visit any page, even if they don't log in successfully This means that an event is triggered even if the login form is viewed

Can someone point out some of my JBoss as 6 (or equivalent) documents that show how to run custom code when a user logs in successfully for the first time?

Thank you in advance

Solution

You can add a servlet filter implementation before a secure servlet

On each call, the filter tests the boolean flag notfirstcall. In httpsession

If the flag does not exist, the request is the first request after the user logs in It can call the specified job and then set the flag notfirstcall to mark the job as having completed the session

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>