-
-
Save azurewraith/e553831730072e03f6f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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