Class: Rack::Authentication::Adapters::Basic

Inherits:
Base
  • Object
show all
Defined in:
lib/rack/authentication/adapters/basic.rb

Instance Attribute Summary

Attributes inherited from Base

#credentials, #env, #type

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Rack::Authentication::Adapters::Base

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/rack/authentication/adapters/basic.rb', line 7

def authorized?
  username, password = credentials
  return false if username.nil? || password.nil?
  ENV["#{username.upcase}_PASSWORD"] == password
end

#good?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/rack/authentication/adapters/basic.rb', line 3

def good?
  "Basic" == type
end