Environment : Cloud (Confluence, JSD, JSW)
The events I'm finding in the documentations are related to the Atlassian tooling (issues, pages, etc.).
I can't seem to find the answer so here is the question : can I use ScriptRunner to trigger an action on login / on logout ?
About the use-cases:
- For the login, I'm trying to exploit some custom SAML attributes that I'm receiving from an identity provider on login (I'm using SAML SSO).
- For the logout, I want to call an API to notify the identity provider that the user logged-out (there's no logout binding).
Thank you all in advance,
I've been able to trigger some actions on login event.
But I am not sure how you would tie in your login event script with the SAML attributes unless you can make some api call back to your saml idp and retrieve those attributes again.
However, with SAML SSO (reichert solution) I am not detecting any logout event.
If you can't do logout binding, perhaps you can trick your system by hiding the default logout link, and substitute your own that would go to a scriptrunner rest api and after your script runs, you redirect the user to the default logout page.
Hi @Peter-Dave Sheehan and thanks!
Your answers are quite encouraging for the current investigation and I thank you very much for the side-tips about the use-cases.
I'd like to know where you went to detect the events / how you did it. Can you redirect me to some documentation please ? I can't seem to go further than manipulating existing events in the "Script Listeners" tab / testing code in the "Script Console" tab.
Thanks a lot again,
Well, the Script Listener tab is where you want to be.
In my case all I did was write a line of text to the log:
Then I tailed the log while logging out with a test account and saw that line go in the log.
Both the LoginEvent and the LogoutEvent generate an UserEvent (as subclasses).
You can see the documentation for those event classes here: https://docs.atlassian.com/software/jira/docs/api/8.11.1/com/atlassian/jira/event/user/UserEvent.html
You will see that there isn't a whole lot of information in those classes, but at least the user is there, that's probably the most critical piece.
The rest of the script will really be depending on what you intend to do.
The only other documentation I can point you to is the generic custom listener page at adaptivist: https://scriptrunner.adaptavist.com/6.5.0-p5/jira/listeners.html#_custom_listeners
Thank you very much @Peter-Dave Sheehan, that's very informative.
However, I noticed that I'm talking about ScriptRunner for Jira Cloud and you're talking about ScriptRunner for Jira Server.
As such, I can't find the same events and I can't even find the "Custom Listeners" tab.
Should I give up?
My bad... I completely missed that you were working with Cloud.
Unfortunately, I know nothing of the capabilities and limitations of scriptrunner in a cloud environment. Especially with regards to listeners.
At a quick glance, there doesn't appear to be any login/logout event that can be used in a cloud listener. There is user_created, user_deleted and user_updated events only
Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their Jira Cloud instance. ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events