@Test public void dontResetAuthenticationFailureCounterWhenAccountRemainsInactive() { when(this.updatedDocument.getOriginalDocument().getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE) .getIntValue("active")).thenReturn(0); when(this.updatedDocument.getXObject(DisableAccountFailureStrategy.USER_CLASS_REFERENCE).getIntValue("active")) .thenReturn(0); disableStrategy.onEvent(new DocumentUpdatedEvent(), this.updatedDocument, null); verify(this.authenticationFailureManagerProvider.get(), never()) .resetAuthenticationFailureCounter(this.updatedDocument.getDocumentReference()); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument updatedDocument = (XWikiDocument) source; BaseObject updatedUserObject = updatedDocument.getXObject(USER_CLASS_REFERENCE); XWikiDocument originalDocument = updatedDocument.getOriginalDocument(); BaseObject originalUserObject = originalDocument.getXObject(USER_CLASS_REFERENCE); if (originalUserObject != null && updatedUserObject != null && (propertyValueChanged(originalUserObject, updatedUserObject, XWikiUser.ACTIVE_PROPERTY, 1))) { this.authenticationFailureManager.get() .resetAuthenticationFailureCounter(updatedDocument.getDocumentReference()); } }
DisableAccountFailureStrategy implements AuthenticationFailureStrategy, EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument updatedDocument = (XWikiDocument) source; BaseObject updatedUserObject = updatedDocument.getXObject(USER_CLASS_REFERENCE); XWikiDocument originalDocument = updatedDocument.getOriginalDocument(); BaseObject originalUserObject = originalDocument.getXObject(USER_CLASS_REFERENCE); if (originalUserObject != null && updatedUserObject != null && (propertyValueChanged(originalUserObject, updatedUserObject, XWikiUser.ACTIVE_PROPERTY, 1))) { this.authenticationFailureManager.get() .resetAuthenticationFailureCounter(updatedDocument.getDocumentReference()); } } }
DisableAccountFailureStrategy implements AuthenticationFailureStrategy, EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument updatedDocument = (XWikiDocument) source; BaseObject updatedUserObject = updatedDocument.getXObject(USER_CLASS_REFERENCE); XWikiDocument originalDocument = updatedDocument.getOriginalDocument(); BaseObject originalUserObject = originalDocument.getXObject(USER_CLASS_REFERENCE); if (originalUserObject != null && updatedUserObject != null && (propertyValueChanged(originalUserObject, updatedUserObject, XWikiUser.ACTIVE_PROPERTY, 1))) { this.authenticationFailureManager.get() .resetAuthenticationFailureCounter(updatedDocument.getDocumentReference()); } }  }
DisableAccountFailureStrategy implements AuthenticationFailureStrategy, EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument updatedDocument = (XWikiDocument) source; BaseObject updatedUserObject = updatedDocument.getXObject(USER_CLASS_REFERENCE); XWikiDocument originalDocument = updatedDocument.getOriginalDocument(); BaseObject originalUserObject = originalDocument.getXObject(USER_CLASS_REFERENCE); if (originalUserObject != null && updatedUserObject != null && (propertyValueChanged(originalUserObject, updatedUserObject, XWikiUser.ACTIVE_PROPERTY, 1))) { this.authenticationFailureManager.get() .resetAuthenticationFailureCounter(updatedDocument.getDocumentReference()); } }  @Override String getErrorMessage(String username); @Override String getForm(String username); @Override boolean validateForm(String username, SecurityRequestWrapper request); @Override void notify(String username); @Override List<Event> getEvents(); @Override String getName(); @Override void onEvent(Event event, Object source, Object data); }
DisableAccountFailureStrategy implements AuthenticationFailureStrategy, EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument updatedDocument = (XWikiDocument) source; BaseObject updatedUserObject = updatedDocument.getXObject(USER_CLASS_REFERENCE); XWikiDocument originalDocument = updatedDocument.getOriginalDocument(); BaseObject originalUserObject = originalDocument.getXObject(USER_CLASS_REFERENCE); if (originalUserObject != null && updatedUserObject != null && (propertyValueChanged(originalUserObject, updatedUserObject, XWikiUser.ACTIVE_PROPERTY, 1))) { this.authenticationFailureManager.get() .resetAuthenticationFailureCounter(updatedDocument.getDocumentReference()); } }  @Override String getErrorMessage(String username); @Override String getForm(String username); @Override boolean validateForm(String username, SecurityRequestWrapper request); @Override void notify(String username); @Override List<Event> getEvents(); @Override String getName(); @Override void onEvent(Event event, Object source, Object data); static final String NAME; }