Hello,
I am using Behaviour Select List Conversions which is described here https://scriptrunner.adaptavist.com/4.3.5/jira/behaviours-conversions.html.
I want to make a field that will allow me to select Test Cycle in Test Plan (SynapseRT Plugin). To ask about those cycles I can use SynapseRT REST API "Get Test Cycles in a Test Plan" (GET /rest/synapse/latest/public/testPlan/{testPlanIssueKey}/cycles).
Thus I need to make external api call which in fact is internal because baseURL and credentials I need to provide are the same like in Jira.
Currently in my Rest-Endpoint code I am using basicAuth:
def url = new URL("$jiraBaseUrl/rest/synapse/latest/public/testPlan/$planKey/cycles")
def urlConnection = url.openConnection();
urlConnection.setRequestProperty("Authorization", jiraCredentials)
urlConnection.connect()Is there any way to get rid of hard-coded credentials?
I have also some rest-endpoints which connects with bamboo and I see possibilities to do calls as logged in user... so i belive that there is also possiblitiy to do sth similar wtih Jira - Jira like in Jira - Bamboo.
In Jira-Bamboo Rest-Endpoint i do requests with such auth:
// Integration & Auth Info
def techUser = ComponentAccessor.jiraAuthenticationContext.setLoggedInUser(ComponentAccessor.getUserManager().getUserByName("jira-test-user"))
def appLinkService = ComponentLocator.getComponent(ApplicationLinkService)
def appLink = appLinkService.applicationLinks.findAll{it -> it.name.toString()=="BambooPRE"}
ApplicationLink bambooAppLink = appLink?.getAt(0)
def applicationLinkRequestFactory = bambooAppLink.createAuthenticatedRequestFactory()