Skip to content

Instantly share code, notes, and snippets.

@nazy
nazy / mruby_authn_http.rb
Created December 8, 2012 12:41
Authn delegation via HTTP by mod_mruby
HOST="127.0.0.1"
PORT=80
PATH="/redmine/users/current.xml" # Using Redmine REST I/F as an example.
def main
anp = Apache::AuthnProvider.new
credentials = [[anp.user, anp.password].join(":")].pack("m").gsub("\n", "")
request = {}
request['User-Agent'] = "mruby_authn_http/0.1"
request['Authorization'] = "Basic #{credentials}"