nickva commented on code in PR #5032:
URL: https://github.com/apache/couchdb/pull/5032#discussion_r1581378669
##########
test/elixir/test/auth_lockout_test.exs:
##########
@@ -0,0 +1,48 @@
+defmodule AuthLockoutTest do
+ use CouchTestCase
+
+ @moduletag :authentication
+
+ @moduletag config: [
+ {
+ "admins",
+ "couch_auth_lockout",
+ "bar"
+ }
+ ]
+
+ test "lockout after multiple failed authentications", _context do
+ server_config = [
+ %{
+ :section => "couch_auth_lockout",
+ :key => "mode",
+ :value => "enforce"
+ }
+ ]
+
+ run_on_modified_server(
+ server_config,
+ fn -> test_couch_auth_lockout_enforcement() end
+ )
+ end
+
+ defp test_couch_auth_lockout_enforcement do
+ # exceed the lockout threshold
+ for _n <- 1..5 do
+ resp = Couch.get("/_all_dbs",
+ no_auth: true,
+ headers: [authorization: "Basic
#{:base64.encode("couch_auth_lockout:baz")}"]
+ )
+ assert resp.status_code == 401
+ end
Review Comment:
Might be worth having a few with a `warn` mode just validate that code path
and that doesn't crash anything?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]