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 =

Returns Default allowed origins for origin validation.

Returns:

  • (Array)

    Default allowed origins for origin validation.

['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.



112
113
114
115
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 112

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

Instance Attribute Details

#allowed_originsObject

Returns the value of attribute allowed_origins.



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

def allowed_origins
  @allowed_origins
end

#strict_modeObject

Returns the value of attribute strict_mode.



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

def strict_mode
  @strict_mode
end

Instance Method Details

#apply(hash) ⇒ void

This method returns an undefined value.

Apply origin validation configuration from a hash.

Parameters:

  • hash (Hash)

    configuration values



121
122
123
124
125
126
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 121

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