Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
None
-
4
-
Severity 3 - Minor
-
0
-
Description
Problem Description
Currently the REST API documentation has an example plugin called rest-oauth-client-1.0.one-jar.jar to demonstrate using OAuth to authenticate against JIRA's REST service.
Link: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication
However, this plugin has not been updated for a long time, and at the moment suffers from SNI errors when JIRA is running behind SSL NGinX with SNI:
java -jar rest-oauth-client-1.0.one-jar.jar requestToken https://my-jira-url Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.simontuffs.onejar.Boot.run(Boot.java:340) at com.simontuffs.onejar.Boot.main(Boot.java:166) Caused by: java.lang.RuntimeException: Failed to obtain request token at com.atlassian.oauth.client.example.AtlassianOAuthClient.getRequestToken(AtlassianOAuthClient.java:66) at com.atlassian.oauth.client.example.JIRAOAuthClient.main(JIRAOAuthClient.java:52) ... 6 more Caused by: javax.net.ssl.SSLException: hostname in certificate didn't match: <my-jira-url> != <url1> OR <url2> OR <url3> at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:222) at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:151) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:131) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:326)
This is because the plugin is using an outdated version of the HTTPClient library, httpclient-4.0-beta2.jar
SNI bug is fixed in httpclient 4.5.3: https://issues.apache.org/jira/browse/HTTPCLIENT-1726
Solution
Update the plugin to use the newer version of the httpclient library, e.g. 4.5.3.
Workaround
None.