Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-61881

Update rest-oauth-client plugin in the REST API OAuth Authentication documentation to use newer version of HTTPClient library

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • None
    • Documentation - All

    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.

      Attachments

        Activity

          People

            bc878d9874ad Oksana Levchuk (Inactive)
            dleng Daniel Leng (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: