diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-09-07 19:07:46 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-09-08 03:37:23 -0500 |
commit | 9344b77b95decedf5e5db7af99f6af4db2b27ffb (patch) | |
tree | 4523430aa66a6f50d6237dae5e4aacbd26b138d9 /config/initializers | |
parent | 57f74d8da4f4906fde07caa6cb05cbb824edcbc4 (diff) |
[SSO, API] Add Matrix auth API (https://monsterware.dev/monsterpit/matrix-synapse-rest-password-provider)
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/rack_attack.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index cd29afac5..f11e87b11 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -105,6 +105,10 @@ class Rack::Attack req.session[:attempt_user_id] || req.params.dig('user', 'email').presence if req.post? && req.path == '/auth/sign_in' end + throttle('throttle_matrix_auth_attempts/ip', limit: 5, period: 1.minute) do |req| + req.remote_ip if req.path == '/_matrix-internal/identity/v1/check_credentials' + end + self.throttled_response = lambda do |env| now = Time.now.utc match_data = env['rack.attack.match_data'] |