Class: EML::BasicAuth::Verify

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/eml/lib/basic_auth/verify.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_token, username, password) ⇒ Verify

Returns a new instance of Verify.



27
28
29
30
31
# File 'lib/eml/lib/basic_auth/verify.rb', line 27

def initialize(auth_token, username, password)
  @auth_token = T.let(auth_token || "", String)
  @username = T.let(username, String)
  @password = T.let(password, String)
end

Class Method Details

.call(auth_token, username, password) ⇒ Object



16
17
18
# File 'lib/eml/lib/basic_auth/verify.rb', line 16

def self.call(auth_token, username, password)
  new(auth_token, username, password).call
end

Instance Method Details

#callObject



34
35
36
37
38
39
# File 'lib/eml/lib/basic_auth/verify.rb', line 34

def call
  request_token = parse_auth_token
  expected_token = Generate.(@username, @password)

  ::EML::ConstantTimeCompare.(request_token, expected_token)
end