Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,377
Community Members
 
Community Events
176
Community Groups

Append XSRF token to a Script Fragment Link?

Edited

Our dev team is tired of copying data from a parent item to a sub-task every time they create one. I have introduced a new transiton that creates the subtask and copies a set of data elements in the process. This works well but, of course, the transiton button appears in the available transition list. The team would like this transition to appear in the More actions dropdown - specifically, it should replace the normal Create sub-task option in the operations-subtask area.

I have added a scriptrunner fragment that removes the native create sub-task option and a second one to introduce the new option. This custom web item fragment has a "Do What" option of "Navigate to Link". The Link is set to 

/secure/WorkflowUIDispatcher.jspa?id=${issue.id}&action=901

where 901 is the new transition that I'd like run. 

This all works well with the exception of a missing XSRF security token error. If i append &atl_token=mysecuritytoken into the link, the operation works perfectly. 

Is there any option to append the user's token in the above link string?  

2 answers

1 accepted

0 votes
Answer accepted

The support desk at Adaptavist give me this link to the Form Token Handling article on Atlassian's site.

Appending &atl_token=${atl_token} to my above link worked perfectly and was exactly what i was looking for. 

One caveat if you are calling transitions this way is that any screens you may have will not appear in a modal but rather full screen. A minor difference that isnt a deal breaker for me. 

XSRF token is typically in cookies as part of http requests - haven't had a need to generate one myself with Java API yet but this looks promising https://docs.atlassian.com/software/jira/docs/api/8.5.8/com/atlassian/jira/security/xsrf/SimpleXsrfTokenGenerator.html

What comes to mind is..

 - either generate a new token and use it (if it will be valid and work)

 - get the user's xsrf token from the HttpRequest when they open the issue view

 - disable the xsrf token check altogether (via a header passed in the http request)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events