Class: Hitch::DynamicRegistrationRateLimit

Inherits:
Object
  • Object
show all
Defined in:
lib/hitch/dynamic_registration_rate_limit.rb

Overview

Private fixed-window guard for unauthenticated client registration. It counts through the host application's own cache store; the fail-closed policy lives in Hitch::RateLimitStore.

Constant Summary collapse

Unavailable =
Hitch::RateLimitStore::Unavailable
Exceeded =
Hitch::RateLimitStore::Exceeded
SETTING =
"config.dynamic_client_registration_rate_store"

Class Method Summary collapse

Class Method Details

.check!(remote_ip:) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/hitch/dynamic_registration_rate_limit.rb', line 13

def self.check!(remote_ip:)
  configuration = Hitch.configuration
  RateLimitStore.check!(
    configuration.dynamic_client_registration_rate_store,
    RateLimitStore.hmac_key("hitch:dcr:ip:", RateLimitStore.normalize_ip(remote_ip)),
    configuration.dynamic_client_registration_limit,
    setting: SETTING
  )
end