module HasJwtToken::Authenticatable
Public Class Methods
included(base)
click to toggle source
# File lib/has_jwt_token/authenticatable.rb, line 36 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
authenticate(password)
click to toggle source
Calls superclass method
# File lib/has_jwt_token/authenticatable.rb, line 40 def authenticate(password) super(password).tap do |authenticated| @token = authenticated && encode || nil end end
encode()
click to toggle source
# File lib/has_jwt_token/authenticatable.rb, line 46 def encode HasJwtToken::JwtProxy.encode( algorithm: algorithm, payload: model_payload.merge(claims_payload), secret: secret, header_fields: header_fields ) end
Private Instance Methods
has_jwt_token()
click to toggle source
# File lib/has_jwt_token/authenticatable.rb, line 59 def has_jwt_token @has_jwt_token ||= self.class.has_jwt_token(self) end