I’ve set up a connect app in Spring Boot which can happily accept requests from JIRA and then make requests back into JIRA all within the scope of that one request. I’m doing this using code such as:
atlassianHostRestClients.authenticatedAsAddon().put( "/rest/api/3/issue/10050", mapData, String.class );
What I’d like to do is be able to initiate a call into JIRA using this API from an external trigger (e.g. a call from an external system). In this context, the above example is failing with:
java.lang.IllegalArgumentException: URI is not absolute
at java.net.URI.toURL(URI.java:1088) ~[na:1.8.0_181]
at org.springframework.http.client.SimpleClientHttpRequestFactory.createRequest(SimpleClientHttpRequestFactory.java:141) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:89) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at com.atlassian.connect.spring.internal.request.AtlassianConnectHttpRequestInterceptor.intercept(AtlassianConnectHttpRequestInterceptor.java:29) ~[atlassian-connect-spring-boot-core-1.5.1.jar:na]
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:86) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:70) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:652) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
This seems fair, as in this case the framework doesn’t know which AtlassianHost
it should be hitting. I can successfully make a request as a specific user by reading the AtlassianHost
out of the database, but I want to call the API as the addon user.
Is there a way to do this?