]> git.openstreetmap.org Git - chef.git/blob - cookbooks/trac/files/default/trac-authenticate
Merge remote-tracking branch 'github/pull/79'
[chef.git] / cookbooks / trac / files / default / trac-authenticate
1 #!/usr/bin/ruby
2
3 require "net/http"
4 require "uri"
5
6 user = gets.chop
7 pass = gets.chop
8
9 request = Net::HTTP::Get.new("/api/0.6/user/details")
10 request.basic_auth user, pass
11
12 response = Net::HTTP.new("api.openstreetmap.org").request(request)
13
14 exit!(0) if response.is_a?(Net::HTTPSuccess)
15 exit!(1)