Sha256: 4bdf794b32c2f00e5f15e1616a44f9ca9e646eeaa503a1bccd360d58cd90f3fd
Contents?: true
Size: 845 Bytes
Versions: 3
Compression:
Stored size: 845 Bytes
Contents
require 'base64' module ActionHook module Security module Authentication class Base def to_h { "Authorization" => header_value } end end class Token < Base attr_accessor :token def initialize(token) @token = token end def header_value "Token #{token}" end end class BearerToken < Token def header_value "Bearer #{token}" end end class Basic < Base attr_accessor :username, :password def initialize(username:, password:) @username = username @password = password end def header_value encoded = Base64.strict_encode64("#{username}:#{password}") "Basic #{encoded}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
actionhook-1.0.2 | lib/actionhook/security/authentication.rb |
actionhook-1.0.1 | lib/actionhook/security/authentication.rb |
actionhook-1.0.0 | lib/actionhook/security/authentication.rb |