class Seraph::Grape::Authenticator
Attributes
password[R]
user[R]
Public Class Methods
call(user, password)
click to toggle source
# File lib/seraph/grape/authenticator.rb, line 6 def self.call(user, password) new(user, password).call end
new(user, password)
click to toggle source
# File lib/seraph/grape/authenticator.rb, line 10 def initialize(user, password) @user = user @password = password end
Public Instance Methods
call()
click to toggle source
# File lib/seraph/grape/authenticator.rb, line 15 def call return jwt_token if password_valid? false end
Private Instance Methods
jwt_token()
click to toggle source
# File lib/seraph/grape/authenticator.rb, line 24 def jwt_token Seraph::Grape::JWT.encode(user_id: user.id) end
password_valid?()
click to toggle source
# File lib/seraph/grape/authenticator.rb, line 28 def password_valid? Seraph::PasswordComparator.call(user.encrypted_password, password) end