Sha256: 86b5d37fcb1accbb98b1315647023a347cdf0de2a02df69f9cadb193489ac842
Contents?: true
Size: 729 Bytes
Versions: 1
Compression:
Stored size: 729 Bytes
Contents
require 'jwt' module Devise module Models module TokenAuthenticatable extend ActiveSupport::Concern def self.required_fields(klass) [] end def access_token(remote_ip = nil) current_sign_in_at = self.respond_to?(:timedout?) && Time.now.utc current_sign_in_ip = self.token_ip_verifier && remote_ip Base64.strict_encode64(JWT.encode({ id: id, current_sign_in_at: current_sign_in_at, current_sign_in_ip: current_sign_in_ip }, Devise.secret_key, 'HS256')) end def token_ip_verifier self.class.token_ip_verifier end protected module ClassMethods Devise::Models.config(self, :token_ip_verifier) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_token_authenticatable-0.1.4 | lib/devise_token_authenticatable/models/token_authenticatable.rb |