]> git.openstreetmap.org Git - chef.git/blob - cookbooks/trac/files/default/trac-authenticate
Redirect forum.osm.org to forum.openstreetmap.org for https connections
[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.start("api.openstreetmap.org", :use_ssl => true) do |http|
13   http.request(request)
14 end
15
16 exit!(0) if response.is_a?(Net::HTTPSuccess)
17 exit!(1)