hello,
I need to replace old application link with the new one, I need to use OAuth (impersonation) and I just need to set up one side, the other side is already correct.
I’ve got this far:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.core.DefaultApplicationLinkService
import com.atlassian.applinks.spi.link.ApplicationLinkDetails
import com.atlassian.applinks.application.jira.JiraApplicationTypeImpl
import com.atlassian.applinks.core.AppLinkPluginUtil
import com.atlassian.jira.plugin.webresource.JiraWebResourceUrlProvider
import com.atlassian.applinks.application.confluence.ConfluenceApplicationTypeImpl
ApplicationLinkService applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService)
JiraWebResourceUrlProvider jiraWebResourceUrlProvider = ComponentAccessor.getComponent(JiraWebResourceUrlProvider)
AppLinkPluginUtil AppLinkPluginUtil = ComponentAccessor.getComponent(AppLinkPluginUtil)
@WithPlugin(‘com.atlassian.applinks.applinks-plugin’)
@PluginModule
DefaultApplicationLinkService defaultApplicationLinkService;
URI jiraDev02 = new URI(“https://jira-dev03.mydomain.com/”)
ApplicationLinkDetails jiraappDetails = new ApplicationLinkDetails(“Jira_Dev03”, jiraDev02, jiraDev02, true)
ConfluenceApplicationTypeImpl confluenceApplicationTypeImpl = new ConfluenceApplicationTypeImpl(AppLinkPluginUtil, jiraWebResourceUrlProvider)
JiraApplicationTypeImpl jiraApplicationTypeImpl = new JiraApplicationTypeImpl(AppLinkPluginUtil, jiraWebResourceUrlProvider)
applicationLinkService.getApplicationLinks().each{
- defaultApplicationLinkService.deleteApplicationLink(it)*
}
defaultApplicationLinkService.createApplicationLink(jiraApplicationTypeImpl, jiraappDetails)
old links are removed and new is created but “Connections > Local authentication” are set to Disable for both direction and I struggle a lot to find correct method to change it to OAuth (impersonation).
any idea where to search?
Best regards,
Lukasz