Class: RosettAi::Mcp::HttpSecurityConfig::OriginConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/mcp/http_security_config.rb

Overview

Origin validation sub-configuration.

Constant Summary collapse

DEFAULT_ORIGINS =
['http://localhost:*', 'http://127.0.0.1:*'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOriginConfig

Returns a new instance of OriginConfig.



102
103
104
105
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 102

def initialize
  @allowed_origins = DEFAULT_ORIGINS.dup
  @strict_mode = false
end

Instance Attribute Details

#allowed_originsObject

Returns the value of attribute allowed_origins.



100
101
102
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 100

def allowed_origins
  @allowed_origins
end

#strict_modeObject

Returns the value of attribute strict_mode.



100
101
102
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 100

def strict_mode
  @strict_mode
end

Instance Method Details

#apply(hash) ⇒ Object



107
108
109
110
111
112
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 107

def apply(hash)
  return unless hash.is_a?(Hash)

  @allowed_origins = hash['allowed_origins'] if hash['allowed_origins']
  @strict_mode = hash['strict_mode'] if hash.key?('strict_mode')
end