Class: OmniauthOpenidFederation::Configuration
- Inherits:
-
Object
- Object
- OmniauthOpenidFederation::Configuration
- Defined in:
- lib/omniauth_openid_federation/configuration.rb
Instance Attribute Summary collapse
-
#cache_adapter ⇒ Object?
Custom cache adapter (optional) If not set, automatically detects Rails.cache or ActiveSupport::Cache.
-
#cache_ttl ⇒ Integer?
Cache TTL for JWKS in seconds.
-
#clock_skew_tolerance ⇒ Integer
Clock skew tolerance in seconds for entity statement time validation Per OpenID Federation 1.0 Section 3.2.1, time validation MUST allow for clock skew.
-
#http_options ⇒ Hash, ...
HTTP options for HTTP::Options.new Can be a Hash or a Proc that returns a Hash.
-
#http_timeout ⇒ Integer
HTTP request timeout in seconds.
-
#instrumentation ⇒ Proc, ...
Custom instrumentation callback for security events Can be a Proc, object with #call or #notify method, or logger-like object.
-
#max_retries ⇒ Integer
Maximum number of retries for HTTP requests.
-
#max_string_length ⇒ Integer
Maximum string length for request parameters (default: 8192 / 8KB) Prevents DoS attacks while allowing legitimate use cases (e.g., encrypted JWT authorization codes).
-
#retry_delay ⇒ Integer
Retry delay in seconds (will be multiplied by retry attempt).
-
#root_path ⇒ String?
Root path for file operations (optional) Used for resolving relative file paths when Rails.root is not available.
-
#rotate_on_errors ⇒ Boolean
Rotate JWKS cache on key-related errors.
-
#verify_ssl ⇒ Boolean
SSL verification setting.
Class Method Summary collapse
-
.config ⇒ Configuration
Get the global configuration instance (thread-safe).
-
.configure {|config| ... } ⇒ Object
Configure the gem.
-
.reset! ⇒ void
Reset configuration (useful for testing).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 94 def initialize @verify_ssl = true # Default to secure @cache_ttl = nil # Default: manual rotation (never expires) @rotate_on_errors = false # Default: manual rotation only @http_timeout = 10 @max_retries = 3 @retry_delay = 1 = nil @cache_adapter = nil @root_path = nil @clock_skew_tolerance = 60 # Default: 60 seconds clock skew tolerance @instrumentation = nil # Default: no instrumentation @max_string_length = 8192 # Default: 8KB - prevents DoS while allowing legitimate use cases end |
Instance Attribute Details
#cache_adapter ⇒ Object?
Custom cache adapter (optional) If not set, automatically detects Rails.cache or ActiveSupport::Cache
52 53 54 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 52 def cache_adapter @cache_adapter end |
#cache_ttl ⇒ Integer?
Cache TTL for JWKS in seconds
13 14 15 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 13 def cache_ttl @cache_ttl end |
#clock_skew_tolerance ⇒ Integer
Clock skew tolerance in seconds for entity statement time validation Per OpenID Federation 1.0 Section 3.2.1, time validation MUST allow for clock skew
66 67 68 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 66 def clock_skew_tolerance @clock_skew_tolerance end |
#http_options ⇒ Hash, ...
HTTP options for HTTP::Options.new Can be a Hash or a Proc that returns a Hash
40 41 42 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 40 def end |
#http_timeout ⇒ Integer
HTTP request timeout in seconds
23 24 25 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 23 def http_timeout @http_timeout end |
#instrumentation ⇒ Proc, ...
Custom instrumentation callback for security events Can be a Proc, object with #call or #notify method, or logger-like object
85 86 87 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 85 def instrumentation @instrumentation end |
#max_retries ⇒ Integer
Maximum number of retries for HTTP requests
27 28 29 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 27 def max_retries @max_retries end |
#max_string_length ⇒ Integer
Maximum string length for request parameters (default: 8192 / 8KB) Prevents DoS attacks while allowing legitimate use cases (e.g., encrypted JWT authorization codes)
92 93 94 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 92 def max_string_length @max_string_length end |
#retry_delay ⇒ Integer
Retry delay in seconds (will be multiplied by retry attempt)
31 32 33 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 31 def retry_delay @retry_delay end |
#root_path ⇒ String?
Root path for file operations (optional) Used for resolving relative file paths when Rails.root is not available
59 60 61 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 59 def root_path @root_path end |
#rotate_on_errors ⇒ Boolean
Rotate JWKS cache on key-related errors
19 20 21 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 19 def rotate_on_errors @rotate_on_errors end |
#verify_ssl ⇒ Boolean
SSL verification setting
7 8 9 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 7 def verify_ssl @verify_ssl end |
Class Method Details
.config ⇒ Configuration
Get the global configuration instance (thread-safe)
126 127 128 129 130 131 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 126 def self.config @config_mutex ||= Mutex.new @config_mutex.synchronize do @config ||= new end end |
.configure {|config| ... } ⇒ Object
Configure the gem
118 119 120 121 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 118 def self.configure yield(config) if block_given? config end |
.reset! ⇒ void
This method returns an undefined value.
Reset configuration (useful for testing)
136 137 138 139 140 141 |
# File 'lib/omniauth_openid_federation/configuration.rb', line 136 def self.reset! @config_mutex ||= Mutex.new @config_mutex.synchronize do @config = nil end end |