/** * Retrieves the current authentication. * * @return The current authentication. */ public Authentication getAuthentication() { final Authentication authentication = authenticationProvider.get(); if (authentication.getUserEmail() == null) { // Search the last logged user in the users database final Storage storage = Storage.getLocalStorageIfSupported(); final String email = storage.getItem(LocalDispatchServiceAsync.LAST_USER_ITEM); authentication.setUserEmail(email); } return authentication; }