Class: RosettAi::Mcp::HttpSecurityConfig

Inherits:
Object
  • Object
show all
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.

Author:

  • hugo

  • claude

Defined Under Namespace

Classes: AuthConfig, CorsConfig, OriginConfig, RateLimitConfig, TlsConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHttpSecurityConfig

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

#authenticationObject

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_enforcementObject

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

#corsObject

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_sizeObject

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

#originObject

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_limitingObject

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

#tlsObject

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.

Parameters:

  • hash (Hash)

    configuration hash



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