Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Logout events not working in openSSO.
Hi Everyone,
I am using liferay 6.2 . I wanted to perform some task when the user logs out. But, since i am using openSSO configuration, the " logout.events.post " does not seem to be called or run. Without the " openSSO ", the logout events seems to work pretty fine. So, please can someone help in how can i perform custom logout events for "openSSO".
I am using liferay 6.2 . I wanted to perform some task when the user logs out. But, since i am using openSSO configuration, the " logout.events.post " does not seem to be called or run. Without the " openSSO ", the logout events seems to work pretty fine. So, please can someone help in how can i perform custom logout events for "openSSO".
Well, been awhile that I had to do with OpenSSO. Same with 6.2 actually.
How do you do the logout?
I mean, do you send the user to /c/portal/login or do you send him to /opensso/UI/Logout?goto=...?
Or do you use an Agent with a filter (that's what I did since I never could keep the session times in sync).
How do you do the logout?
I mean, do you send the user to /c/portal/login or do you send him to /opensso/UI/Logout?goto=...?
Or do you use an Agent with a filter (that's what I did since I never could keep the session times in sync).
Hi Christoph,
I am sending the user to c/portal/logout .
I am sending the user to c/portal/logout .
As far as I remember, c/portal/logout redirects to the opensso logout url. Maybe it probably doesn't trigger the logout event.
Hmm, do you get the LOGOUT_EVENTS_PRE event?
Hmm, do you get the LOGOUT_EVENTS_PRE event?
I just looked into the code:
https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portal/servlet/filters/sso/opensso/OpenSSOFilter.java
I believe, it just doesn't trigger those events at all and just destroys the session.
It would need to call the EventsProcessor.
https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portal/action/LogoutAction.java
I am not sure, how to solve that. If you are an Enterprise customer, you could try opening a ticket.
If you are CE, well, if it were me, I would probably just clone the repository, change the code and replace the class file with my own version.
https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portal/servlet/filters/sso/opensso/OpenSSOFilter.java
I believe, it just doesn't trigger those events at all and just destroys the session.
It would need to call the EventsProcessor.
https://github.com/liferay/liferay-portal/blob/6.2.x/portal-impl/src/com/liferay/portal/action/LogoutAction.java
I am not sure, how to solve that. If you are an Enterprise customer, you could try opening a ticket.
If you are CE, well, if it were me, I would probably just clone the repository, change the code and replace the class file with my own version.
Hi Christoph,
I was just going through different ways i can perform that logout operation in openSSO. And I noticed one thing !! The Session Expiry Action gets called at the time of logout also!! And When I am logging out in openSSO, though it is not redirecting to "logout.events.pre" but it is surely going in "SessionExpiryAction". Then I tried performing the operation in the Session Expiry Action, but I getting NULL user there. Now, if there anyhow I can get the user, my work will be sorted out. Though there are ways like getting the user id at login time and using that userId as global variable, but then comes the problem of multiple users login, So i need to figure out some way how can I get the UserId in Session Expiry Action itself. If you have any idea then please help me out !!
I was just going through different ways i can perform that logout operation in openSSO. And I noticed one thing !! The Session Expiry Action gets called at the time of logout also!! And When I am logging out in openSSO, though it is not redirecting to "logout.events.pre" but it is surely going in "SessionExpiryAction". Then I tried performing the operation in the Session Expiry Action, but I getting NULL user there. Now, if there anyhow I can get the user, my work will be sorted out. Though there are ways like getting the user id at login time and using that userId as global variable, but then comes the problem of multiple users login, So i need to figure out some way how can I get the UserId in Session Expiry Action itself. If you have any idea then please help me out !!
I am not sure what you mean with SessionExpiryAction. Do you mean, you have implemented an HttpSessionListener? In that case, you should be able to fetch the session from the event and fetch the user from the session.
I am not sure, which attribute you need to fetch, I would probably just print the attribute names, something useful should be in there.
I am not sure, which attribute you need to fetch, I would probably just print the attribute names, something useful should be in there.
I have tried a lot, but I am not able to get the user from the session. Also, i tried implementing the above code you sent but there are no "org.apache.struts.action" library in my liferay 6.2 so I am not able to use "ActionMapping" , "ActionForm" and "ActionForward"
But if I can find the user using HttpSession , then my motive could be accheived..

Hi christoph,
I think I found the solution, I made the "login.events.post"action and there As the user logs in at that time I am taking out session with the help of "httprequest" and then setting the user id with the help of session.setAttribute("uid",userId) .Then at the time of sessionexpiry I am getting the user id from session.getAttribute("uid"); !!!!!! It seems to work fine. Let me know if this approach can create some problem or not!!
I think I found the solution, I made the "login.events.post"action and there As the user logs in at that time I am taking out session with the help of "httprequest" and then setting the user id with the help of session.setAttribute("uid",userId) .Then at the time of sessionexpiry I am getting the user id from session.getAttribute("uid"); !!!!!! It seems to work fine. Let me know if this approach can create some problem or not!!
This approach should work.
But I am a bit confused that the session doesn't already contain the userId. Have you tried to enumerate the session attributes and print them?
Could you try e.g.:
session.getAttribute("open.sso.subject.id");
Note: This works only when you login using opensso. Your solution should work always, no matter the login method.
But I am a bit confused that the session doesn't already contain the userId. Have you tried to enumerate the session attributes and print them?
Could you try e.g.:
session.getAttribute("open.sso.subject.id");
Note: This works only when you login using opensso. Your solution should work always, no matter the login method.
Ok Thanks Christoph.
thanks christoph ,
let me give it a try..
let me give it a try..
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™