Wed, 13 Sep 2006
Retrieving user login/pass from HTTP_AUTH*

I'm using this to get login information from mod_ldap_auth - user is authenticated against Microsoft's Active Directory (AD)

def getAuthenticated
  if request.env['HTTP_AUTHORIZATION'] then
    authdata = request.env['HTTP_AUTHORIZATION'].to_s.split
    user,pass = Base64.decode64(authdata[1]).split(':')[0..1]
    [ user, pass ]
  else
    [ "", "" ]
  end
end


(posted at 11:14 | filed under programming/rails | link)    (comments | add new)