001package org.gbif.api.service.common;
002
003import org.gbif.api.model.common.GbifUser;
004
005import javax.annotation.Nullable;
006
007/**
008 * Identity service accessing a single user, in read-only.
009 * This is a replacement of the deprecated {@link UserService}.
010 */
011public interface IdentityAccessService {
012
013  /**
014   * Get a {@link GbifUser} by identifier (username or email).
015   *
016   * @param identifier username or email
017   *
018   * @return the user or null if the user is not found
019   */
020  @Nullable
021  GbifUser get(String identifier);
022
023  /**
024   * Authenticates a user.
025   *
026   * @param identifier username or email
027   * @param password clear text password
028   *
029   * @return the authenticated user or null if not found or wrong credentials provided
030   */
031  @Nullable
032  GbifUser authenticate(String identifier, String password);
033
034}