Ejemplo n.º 1
0
  /**
   * 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;
  }
Ejemplo n.º 2
0
 /**
  * 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();
 }