Oauth implementation using Groovy Script Runner

raj-kumar2 March 2, 2020

Hi,

We are working on integrating Jira with Workday. We have got Client ID, Key and Authorization url from Workday and need to implement OAuth authentication using Groovy.

Can you please share the code to setup Oauth2.0 authentication by using Groovy? Or is there any other method from Jira we can use to implement Oauth?

Regards,

Raj

1 answer

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 3, 2020

Hi @raj-kumar2 

Can't you just add Workday as a generic application link with OAuth in the JIra Application Links Configuration?

Then you can just leverage the application link object in groovy.

Something along these lines:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.applinks.JiraApplicationLinkService
import com.atlassian.sal.api.net.Response
import com.atlassian.sal.api.net.ResponseException
import com.atlassian.sal.api.net.ResponseHandler
import com.atlassian.sal.api.net.Request.MethodType

def appLinkService = ComponentAccessor.getComponent(JiraApplicationLinkService.class)
def appLink = appLinkService.getApplicationLinks().find{it.name == 'Workday'}
def appLinkRequestFactory = appLink.createAuthenticatedRequestFactory()
def request = appLinkRequestFactory.createRequest(MethodType.POST, 'workday/endpoint')

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events