Skip to content

Instantly share code, notes, and snippets.

@azurewraith
Forked from arax/gist:5527509
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azurewraith/e553831730072e03f6f8 to your computer and use it in GitHub Desktop.
Save azurewraith/e553831730072e03f6f8 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'httpi'
require 'curb'
require 'pp'
require 'json'
################################
# kinit user@REALM
# kinit -k -t /ticket/path
################################
HOST = 'localhost'
PORT = 443
PATH = 'resource.json'
HTTPI.adapter = :curb
req = HTTPI::Request.new
req.url = URI.escape("https://#{HOST}:#{PORT}/#{PATH}")
# use spnego
req.auth.gssnegotiate
resp = HTTPI.get(req){ |http| http.use_ssl }
if resp.code == 200
STDERR.puts "Endpoint successfully queried, dumping JSON body:\n"
pp JSON.parse(resp.body)
else
STDERR.puts "Error :("
STDERR.puts resp.inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment