Class: ActionHook::Security::Authentication::Basic

Inherits:
Base
  • Object
show all
Defined in:
lib/actionhook/security/authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_h

Constructor Details

#initialize(username:, password:) ⇒ Basic

Returns a new instance of Basic.



35
36
37
38
# File 'lib/actionhook/security/authentication.rb', line 35

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

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



33
34
35
# File 'lib/actionhook/security/authentication.rb', line 33

def password
  @password
end

#usernameObject

Returns the value of attribute username.



33
34
35
# File 'lib/actionhook/security/authentication.rb', line 33

def username
  @username
end

Instance Method Details

#header_valueObject



40
41
42
43
# File 'lib/actionhook/security/authentication.rb', line 40

def header_value
  encoded = Base64.strict_encode64("#{username}:#{password}")
  "Basic #{encoded}"
end