Module: EventParsers::Http11Parser::BasicAuth

Defined in:
bin/httphere

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(basic_auth_string) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
# File 'bin/httphere', line 312

def parse(basic_auth_string)
  # Do the special decoding here
  if basic_auth_string =~ /^Basic (.*)$/
    auth_string = $1
    auth_plain = Base64.decode64(auth_string)
    return auth_plain.split(/:/,2)
  else
    warn "Bad Auth string!"
    raise UnparsableBasicAuth
  end
end

Instance Method Details

#initialize(username, password) ⇒ Object



325
326
327
328
# File 'bin/httphere', line 325

def initialize(username, password)
  @username = username
  @password = password
end

#to_sObject



330
331
332
# File 'bin/httphere', line 330

def to_s
  # Do the special encoding here
end