module Sorcery::Model::Submodules::Jwt
Public Class Methods
included(base)
click to toggle source
# File lib/sorcery/model/submodules/jwt.rb, line 8 def self.included(base) base.sorcery_config.class_eval do # Secret used to encode JWTs. Should correspond to the type needed by the algorithm used. attr_accessor :jwt_secret # Type of the algorithm used to encode JWTs. Corresponds to the options available in jwt/ruby-jwt. attr_accessor :jwt_algorithm # How long the session should be valid for in seconds. Will be set as the exp claim in the token. attr_accessor :session_expiry end base.sorcery_config.instance_eval do @defaults[:@jwt_algorithm] = "HS256" @defaults[:@session_expiry] = 60 * 60 * 24 * 7 * 2 # 2 weeks reset! end base.sorcery_config.after_config << :validate_secret_defined base.extend(ClassMethods) base.send(:include, InstanceMethods) end