@Test public void getForm() { String formStrategy1 = "formStrategy1"; String formStrategy2 = "formStrategy2"; when(this.strategy1.getForm(eq(this.failingLogin))).thenReturn(formStrategy1); when(this.strategy2.getForm(eq(this.failingLogin))).thenReturn(formStrategy2); assertEquals("", this.defaultAuthenticationFailureManager.getForm(this.failingLogin)); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(this.failingLogin); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(this.failingLogin); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(this.failingLogin); assertEquals(String.format("%s\n%s\n", formStrategy1, formStrategy2), this.defaultAuthenticationFailureManager.getForm(this.failingLogin)); }
@Override public String getForm(String username) { StringBuilder builder = new StringBuilder(); if (isThresholdReached(username)) { for (AuthenticationFailureStrategy authenticationFailureStrategy : getFailureStrategyList()) { builder.append(authenticationFailureStrategy.getForm(username)); builder.append(STRING_AGGREGATION_SEPARATOR); } } return builder.toString(); }
DefaultAuthenticationFailureManager implements AuthenticationFailureManager { @Override public String getForm(String username) { StringBuilder builder = new StringBuilder(); if (isThresholdReached(username)) { for (AuthenticationFailureStrategy authenticationFailureStrategy : getFailureStrategyList()) { builder.append(authenticationFailureStrategy.getForm(username)); builder.append(STRING_AGGREGATION_SEPARATOR); } } return builder.toString(); } }
DefaultAuthenticationFailureManager implements AuthenticationFailureManager { @Override public String getForm(String username) { StringBuilder builder = new StringBuilder(); if (isThresholdReached(username)) { for (AuthenticationFailureStrategy authenticationFailureStrategy : getFailureStrategyList()) { builder.append(authenticationFailureStrategy.getForm(username)); builder.append(STRING_AGGREGATION_SEPARATOR); } } return builder.toString(); } DefaultAuthenticationFailureManager(); }
DefaultAuthenticationFailureManager implements AuthenticationFailureManager { @Override public String getForm(String username) { StringBuilder builder = new StringBuilder(); if (isThresholdReached(username)) { for (AuthenticationFailureStrategy authenticationFailureStrategy : getFailureStrategyList()) { builder.append(authenticationFailureStrategy.getForm(username)); builder.append(STRING_AGGREGATION_SEPARATOR); } } return builder.toString(); } DefaultAuthenticationFailureManager(); @Override boolean recordAuthenticationFailure(String username); @Override void resetAuthenticationFailureCounter(DocumentReference user); @Override void resetAuthenticationFailureCounter(String username); @Override String getForm(String username); @Override boolean validateForm(String username, SecurityRequestWrapper request); @Override String getErrorMessage(String username); @Override DocumentReference findUser(String username); }
DefaultAuthenticationFailureManager implements AuthenticationFailureManager { @Override public String getForm(String username) { StringBuilder builder = new StringBuilder(); if (isThresholdReached(username)) { for (AuthenticationFailureStrategy authenticationFailureStrategy : getFailureStrategyList()) { builder.append(authenticationFailureStrategy.getForm(username)); builder.append(STRING_AGGREGATION_SEPARATOR); } } return builder.toString(); } DefaultAuthenticationFailureManager(); @Override boolean recordAuthenticationFailure(String username); @Override void resetAuthenticationFailureCounter(DocumentReference user); @Override void resetAuthenticationFailureCounter(String username); @Override String getForm(String username); @Override boolean validateForm(String username, SecurityRequestWrapper request); @Override String getErrorMessage(String username); @Override DocumentReference findUser(String username);  }