Class: RosettAi::Mcp::HttpSecurityConfig::OriginConfig
- Inherits:
-
Object
- Object
- RosettAi::Mcp::HttpSecurityConfig::OriginConfig
- 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.
['http://localhost:*', 'http://127.0.0.1:*'].freeze
Instance Attribute Summary collapse
-
#allowed_origins ⇒ Object
Returns the value of attribute allowed_origins.
-
#strict_mode ⇒ Object
Returns the value of attribute strict_mode.
Instance Method Summary collapse
-
#apply(hash) ⇒ void
Apply origin validation configuration from a hash.
-
#initialize ⇒ OriginConfig
constructor
A new instance of OriginConfig.
Constructor Details
#initialize ⇒ OriginConfig
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_origins ⇒ Object
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_mode ⇒ Object
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.
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 |