Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2b4f1b1c8f
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (17 sloc) 0.601 kb
module BasicAuth
def decode_credentials(request)
Base64.decode64(request).split.last
end
def user_name_and_password(request)
decode_credentials(request).split(/:/, 2)
end
def authentication_data
headers = @http_headers.split("\000")
auth_header = headers.detect {|head| head =~ /Authorization: / }
header = auth_header.nil? ? "" : auth_header.split("Authorization: Basic ").last
return (user_name_and_password(header) rescue ['', ''])
end
def authenticate!(http_header)
raise NotAuthenticatedError unless authenticate(http_header)
end
end
Jump to Line
Something went wrong with that request. Please try again.