Class: RosettAi::Mcp::HttpSecurityConfig
- Inherits:
-
Object
- Object
- RosettAi::Mcp::HttpSecurityConfig
- Defined in:
- lib/rosett_ai/mcp/http_security_config.rb
Overview
Typed HTTP security configuration hierarchy.
Seven typed sub-config classes covering authentication, TLS, origin validation, rate limiting, CORS, and content type.
Defined Under Namespace
Classes: AuthConfig, CorsConfig, OriginConfig, RateLimitConfig, TlsConfig
Instance Attribute Summary collapse
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#content_type_enforcement ⇒ Object
Returns the value of attribute content_type_enforcement.
-
#cors ⇒ Object
Returns the value of attribute cors.
-
#max_request_size ⇒ Object
Returns the value of attribute max_request_size.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#rate_limiting ⇒ Object
Returns the value of attribute rate_limiting.
-
#tls ⇒ Object
Returns the value of attribute tls.
Instance Method Summary collapse
-
#apply(hash)
Apply a configuration hash from YAML.
-
#initialize ⇒ HttpSecurityConfig
constructor
A new instance of HttpSecurityConfig.
Constructor Details
#initialize ⇒ HttpSecurityConfig
Returns a new instance of HttpSecurityConfig.
19 20 21 22 23 24 25 26 27 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 19 def initialize @authentication = AuthConfig.new @tls = TlsConfig.new @origin = OriginConfig.new @rate_limiting = RateLimitConfig.new @max_request_size = 1_048_576 @content_type_enforcement = true @cors = CorsConfig.new end |
Instance Attribute Details
#authentication ⇒ Object
Returns the value of attribute authentication.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def authentication @authentication end |
#content_type_enforcement ⇒ Object
Returns the value of attribute content_type_enforcement.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def content_type_enforcement @content_type_enforcement end |
#cors ⇒ Object
Returns the value of attribute cors.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def cors @cors end |
#max_request_size ⇒ Object
Returns the value of attribute max_request_size.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def max_request_size @max_request_size end |
#origin ⇒ Object
Returns the value of attribute origin.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def origin @origin end |
#rate_limiting ⇒ Object
Returns the value of attribute rate_limiting.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def rate_limiting @rate_limiting end |
#tls ⇒ Object
Returns the value of attribute tls.
16 17 18 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 16 def tls @tls end |
Instance Method Details
#apply(hash)
This method returns an undefined value.
Apply a configuration hash from YAML.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 33 def apply(hash) return unless hash.is_a?(Hash) @authentication.apply(hash['authentication']) if hash['authentication'] @tls.apply(hash['tls']) if hash['tls'] @origin.apply(hash['origin']) if hash['origin'] @rate_limiting.apply(hash['rate_limiting']) if hash['rate_limiting'] @cors.apply(hash['cors']) if hash['cors'] @max_request_size = hash['max_request_size'] if hash['max_request_size'] @content_type_enforcement = hash['content_type_enforcement'] if hash.key?('content_type_enforcement') end |