/** * 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; }
/** * Returns <code>true</code> if the current user is anonymous. * * @return <code>true</code> if the current user is anonymous, <code>false</code> otherwise. */ public boolean isAnonymous() { return authenticationProvider.isAnonymous(); }