Module: FastMcpJwtAuth::RackTransportPatch

Defined in:
lib/fast_mcp_jwt_auth/rack_transport_patch.rb

Overview

Lazy patch application - applies patch when FastMcp transport is first accessed

Defined Under Namespace

Modules: JwtAuthenticationPatch

Class Method Summary collapse

Class Method Details

.apply_patch!Object



11
12
13
14
15
16
17
# File 'lib/fast_mcp_jwt_auth/rack_transport_patch.rb', line 11

def self.apply_patch!
  return FastMcpJwtAuth.log_debug("RackTransport patch already applied, skipping") if @patch_applied
  return FastMcpJwtAuth.log_debug("FastMcp::Transports::RackTransport not defined yet, skipping patch") unless defined?(FastMcp::Transports::RackTransport)
  return FastMcpJwtAuth.log_debug("JWT authentication disabled, skipping patch") unless FastMcpJwtAuth.config.enabled

  apply_patch_to_transport
end

.apply_patch_to_transportObject



19
20
21
22
23
24
# File 'lib/fast_mcp_jwt_auth/rack_transport_patch.rb', line 19

def self.apply_patch_to_transport
  FastMcpJwtAuth.log_info "Applying JWT authentication patch to FastMcp::Transports::RackTransport"
  patch_transport_class
  @patch_applied = true
  FastMcpJwtAuth.log_info "JWT authentication patch applied successfully"
end

.patch_applied?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fast_mcp_jwt_auth/rack_transport_patch.rb', line 30

def self.patch_applied?
  @patch_applied
end

.patch_transport_classObject



26
27
28
# File 'lib/fast_mcp_jwt_auth/rack_transport_patch.rb', line 26

def self.patch_transport_class
  FastMcp::Transports::RackTransport.prepend(JwtAuthenticationPatch)
end