I'm trying to hook up an OAuth consumer using 2-legged authentication. I have two questions:
1) is it possible to use Oauth with a custom REST plugin (as opposed to the built-in API)
2) as a test of the built-in REST API, I'm trying the following, and receiving:
<Net::HTTPUnauthorized 401 Unauthorized readbody=true>
{"errorMessages":["You do not have the permission to see the specified issue","Login Required"],"errors":{}}
Here is the test method:
jira_url = "http://localhost:2990/jira"
consumer_key = "hardcoded-consumer"
consumer_secret = OpenSSL::PKey::RSA.new(IO.read(File.dirname(__FILE__) + "/../rsakey.pem"))
@consumer ||= OAuth::Consumer.new(consumer_key, consumer_secret, {
    :site => 'http://localhost:2990',
    :context_path       => '/jira',
    :signature_method   => 'RSA-SHA1',
    :auth_type          => :oauth,
    :scheme => :header,
    :oauth_callback => false,
    :ssl_verify_mode    => OpenSSL::SSL::VERIFY_PEER,
    :use_ssl            => true,
    :http_method => :post,
    :request_token_path => jira_url + '/plugins/servlet/oauth/request-token',
    :access_token_path  => jira_url + '/plugins/servlet/oauth/access-token',
    :authorize_path     => jira_url + '/plugins/servlet/oauth/authorize'
})
testurl = jira_url + "/rest/api/latest/issue/SPI-1"
puts "1 #################################### first method"
req = @consumer.create_signed_request(:get, testurl, nil)
res = Net::HTTP.start('localhost', '2990') { |http| http.request(req) }
puts res.inspect
puts res.body
puts "2 #################################### second method"
@acc_tok = OAuth::AccessToken.new @consumer
resp = @acc_tok.get(testurl)
puts @acc_tok.inspect
puts resp.inspect
puts resp.body
Both methods output the same error.
Can anyone tell me what I'm doing wrong?
 
     
    