massx1 commented on code in PR #1413:
URL: https://github.com/apache/syncope/pull/1413#discussion_r3373395503
##########
fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java:
##########
@@ -387,6 +388,38 @@ public void checkUserSuspension() {
assertEquals(0,
goodPwdClient.self().user().getFailedLogins().intValue());
}
+ @Test
+ public void authenticationThrottle() {
+ UserCR userCR =
UserITCase.getUniqueSample("[email protected]");
+ userCR.getRoles().add("User manager");
+
+ UserTO userTO = createUser(userCR).getEntity();
+ assertNotNull(userTO);
+
+ for (int i = 0; i < AUTHENTICATION_THROTTLE_MAX_ATTEMPTS - 1; i++) {
+ try {
+ CLIENT_FACTORY.create(userTO.getUsername(), "wrongpwd").self();
+ fail("This should not happen");
+ } catch (NotAuthorizedException e) {
+ assertNotNull(e);
+ }
+ }
+
+ try {
+ CLIENT_FACTORY.create(userTO.getUsername(), "wrongpwd").self();
+ fail("This should not happen");
+ } catch (WebApplicationException e) {
+ assertEquals(Response.Status.TOO_MANY_REQUESTS.getStatusCode(),
e.getResponse().getStatus());
+ }
+
+ try {
+ CLIENT_FACTORY.create(userTO.getUsername(), "password123").self();
Review Comment:
Not clear, I used the same approach of the other tests.
--
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]