Class: Xenon::BasicAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/xenon/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_params = {}, &store) ⇒ BasicAuth

Returns a new instance of BasicAuth.



49
50
51
52
# File 'lib/xenon/auth.rb', line 49

def initialize(auth_params = {}, &store)
  @auth_params = auth_params
  @store = store
end

Instance Attribute Details

#auth_paramsObject (readonly)

Returns the value of attribute auth_params.



47
48
49
# File 'lib/xenon/auth.rb', line 47

def auth_params
  @auth_params
end

Instance Method Details

#call(request) ⇒ Object



58
59
60
61
# File 'lib/xenon/auth.rb', line 58

def call(request)
  header = request.header('Authorization') rescue nil
  @store.call(header.credentials) if header && header.credentials.is_a?(BasicCredentials)
end

#schemeObject



54
55
56
# File 'lib/xenon/auth.rb', line 54

def scheme
  'Basic'
end