Hi all,

The CDI spec defines the "Transactional observer methods" (§10.4.5) with a TransactionPhase :

public enum TransactionPhase {
  IN_PROGRESS,
  BEFORE_COMPLETION,
  AFTER_COMPLETION,
  AFTER_FAILURE,
  AFTER_SUCCESS
}

void onDocumentUpdate(@Observes(during=AFTER_SUCCESS) @Updated Document doc) { ... }


Now that there is a new Security specification coming along, it would be helpful to be able to observe before/after the user logs-in or logs-out, for example. First I thought "well, the Security spec defines a set of events, fires them, and we just have to observe them". But what about the "during" phase ? What would make more sense in such use case ? Using the same "during" mechanism or events ?

public enum LoginPhase {
  BEFORE_LOGIN,
  AFTER_LOGIN,
  BEFORE_LOGOUT,
  AFTER_LOGOUT,
}

void onLogout(@Observes(during=BEFORE_LOGOUT) User user) { ... }


Any thoughts ?

--
Antonio Goncalves
Software architect, Java Champion and Pluralsight author

Web site | TwitterLinkedIn | Pluralsight | Paris JUG | Devoxx France