Changeset 60094181c3ec47eb97e0989cc0682715e347a4dc

Show
Ignore:
Timestamp:
09/29/09 01:51:21 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1254189081 +0000
git-parent:

[6e62ef400bde44470608352410e924c76de33b17]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1254189081 +0000
Message:

implements basic auth, refs #186

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules-lua/noit/module/http.lua

    r45104cd r6009418  
    5050               allowed="\S+" 
    5151               default="GET">The HTTP method to use.</parameter> 
     52    <parameter name="auth_method" 
     53               required="optional" 
     54               allowed="^Basic$">HTTP Authentication method to use.</parameter> 
     55    <parameter name="auth_user" 
     56               required="optional" 
     57               allowed="[^:]*">The user to authenticate as.</parameter> 
     58    <parameter name="auth_password" 
     59               required="optional" 
     60               allowed=".*">The password to use during authentication.</parameter> 
    5261    <parameter name="ca_chain" 
    5362               required="optional" 
     
    175184    -- perform the request 
    176185    local headers = {} 
     186    if check.config.auth_method == "Basic" then 
     187      local user = check.config.auth_user or '' 
     188      local password = check.config.auth_password or '' 
     189      local encoded = noit.base64_encode(user .. ':' .. password) 
     190      headers["Authorization"] = "Basic " .. encoded 
     191    elseif check.config.auth_method ~= nil then 
     192      check.status("Unknown auth method: " .. check.config.auth_method) 
     193      return 
     194    end 
    177195    headers.Host = host 
    178196    for header, value in pairs(check.config) do