Class: FastMcpJwtAuth::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_mcp_jwt_auth/configuration.rb

Overview

Configuration class for FastMcpJwtAuth gem settings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 9

def initialize
  @enabled = true
  @logger = defined?(Rails) ? Rails.logger : Logger.new($stdout)
  @jwt_decoder = nil
  @user_finder = nil
  @token_validator = lambda do |decoded_token|
    decoded_token[:exp].nil? || decoded_token[:exp] >= Time.current.to_i
  end
  @current_user_setter = ->(user) { Current.user = user }
  @current_resetter = -> { Current.reset }
end

Instance Attribute Details

#current_resetterObject

Returns the value of attribute current_resetter.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def current_resetter
  @current_resetter
end

#current_user_setterObject

Returns the value of attribute current_user_setter.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def current_user_setter
  @current_user_setter
end

#enabledObject

Returns the value of attribute enabled.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def enabled
  @enabled
end

#jwt_decoderObject

Returns the value of attribute jwt_decoder.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def jwt_decoder
  @jwt_decoder
end

#loggerObject

Returns the value of attribute logger.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def logger
  @logger
end

#token_validatorObject

Returns the value of attribute token_validator.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def token_validator
  @token_validator
end

#user_finderObject

Returns the value of attribute user_finder.



6
7
8
# File 'lib/fast_mcp_jwt_auth/configuration.rb', line 6

def user_finder
  @user_finder
end